pass the list of packages to package management modules

Instead of looping over a list of packages or repeating the task
separately for different packages, pass the list of packages to the
task performing package management.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
pull/3320/head
Rishabh Dave 2018-11-08 04:26:58 -05:00 committed by mergify[bot]
parent e552026418
commit d72340abbe
5 changed files with 13 additions and 49 deletions

View File

@ -523,27 +523,11 @@
- name: red hat based systems tasks
block:
- name: remove epel-release on redhat
yum:
name: epel-release
state: absent
- name: yum related tasks on red hat
block:
- name: remove pip on redhat
- name: remove packages on redhat
yum:
name: python-pip
state: absent
- name: remove docker-engine on redhat
yum:
name: docker-engine
state: absent
# for CentOS
- name: remove docker on redhat
yum:
name: docker
name: ['epel-release', 'python-pip', 'docker-engine', 'docker']
state: absent
- name: remove package dependencies on redhat

View File

@ -1,14 +1,9 @@
---
- name: allow apt to use a repository over https (debian)
package:
name: "{{ item }}"
name: ['apt-transport-https', 'ca-certificates', 'curl', 'software-properties-common']
state: present
update_cache: yes
with_items:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- name: add docker's gpg key
apt_key:

View File

@ -22,17 +22,11 @@
block:
- name: install docker on ubuntu
package:
name: docker.io
name: ['docker.io', 'python-docker']
state: present
update_cache: yes
tags:
with_pkg
- name: install python-docker on ubuntu
package:
name: python-docker
state: present
tags:
with_pkg
when:
- ansible_distribution == 'Ubuntu'
@ -52,13 +46,7 @@
block:
- name: install python-docker-py on red hat / centos
package:
name: python-docker-py
state: present
tags:
with_pkg
- name: install docker on red hat / centos
package:
name: docker
name: ['docker', 'python-docker-py']
state: present
tags:
with_pkg

View File

@ -55,14 +55,14 @@
update_cache: yes
- name: install nfs rgw/cephfs gateway - debian
apt:
name: "{{ item.name }}"
name: ['nfs-ganesha-rgw', 'radosgw']
allow_unauthenticated: yes
with_items:
- { name: 'nfs-ganesha-rgw', install: "{{ nfs_obj_gw }}" }
- { name: 'radosgw', install: "{{ nfs_obj_gw }}" }
- { name: 'nfs-ganesha-ceph', install: "{{ nfs_file_gw }}" }
when:
- item.install | bool
when: nfs_obj_gw
- name: install nfs rgw/cephfs gateway - debian
apt:
name: nfs-ganesha-ceph
allow_unauthenticated: yes
when: nfs_file_gw
when:
- (ceph_origin == 'repository' or ceph_origin == 'distro')
- ceph_repository != 'rhcs'

View File

@ -45,10 +45,7 @@
- name: install redhat nfs-ganesha-rgw and ceph-radosgw packages
package:
name: "{{ item }}"
name: ['nfs-ganesha-rgw', 'ceph-radosgw']
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
with_items:
- nfs-ganesha-rgw
- ceph-radosgw
when:
- nfs_obj_gw