doc: apt, yum: add example with package lists (#38333)

pull/38390/head
René Moser 7 years ago committed by Martin Krizek
parent fa8b047039
commit af3598343d

@ -141,23 +141,33 @@ EXAMPLES = '''
name: foo name: foo
update_cache: yes update_cache: yes
- name: Install apache service but avoid starting it immediately - name: Install apache httpd but avoid starting it immediately (state=present is optional)
apt: name=apache2 state=present apt:
name: apache2
state: present
environment: environment:
RUNLEVEL: 1 RUNLEVEL: 1
- name: Remove "foo" package - name: Remove "foo" package
apt: name=foo state=absent apt:
name: foo
state: absent
- name: Install the package "foo" - name: Install the package "foo"
apt: apt:
name: foo name: foo
state: present
- name: Install a list of packages
apt:
name: "{{ packages }}"
vars:
packages:
- foo
- foo-tools
- name: Install the version '1.00' of package "foo" - name: Install the version '1.00' of package "foo"
apt: apt:
name: foo=1.00 name: foo=1.00
state: present
- name: Update the repository cache and update package "nginx" to latest version using default release squeeze-backport - name: Update the repository cache and update package "nginx" to latest version using default release squeeze-backport
apt: apt:

@ -25,7 +25,7 @@ description:
options: options:
name: name:
description: description:
- A package name , or package specifier with version, like C(name-1.0). - A package name or package specifier with version, like C(name-1.0).
- If a previous version is specified, the task also needs to turn C(allow_downgrade) on. - If a previous version is specified, the task also needs to turn C(allow_downgrade) on.
See the C(allow_downgrade) documentation for caveats with downgrading packages. See the C(allow_downgrade) documentation for caveats with downgrading packages.
- When using state=latest, this can be '*' which means run C(yum -y update). - When using state=latest, this can be '*' which means run C(yum -y update).
@ -180,6 +180,14 @@ EXAMPLES = '''
name: httpd name: httpd
state: latest state: latest
- name: ensure a list of packages installed
yum:
name: "{{ packages }}"
vars:
packages:
- httpd
- httpd-tools
- name: remove the Apache package - name: remove the Apache package
yum: yum:
name: httpd name: httpd

Loading…
Cancel
Save