From d72340abbe8b2ba71e1b41696140725b736158fd Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Thu, 8 Nov 2018 04:26:58 -0500 Subject: [PATCH] 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 --- .../purge-docker-cluster.yml | 20 ++----------------- .../pre_requisites/debian_prerequisites.yml | 7 +------ .../tasks/pre_requisites/prerequisites.yml | 16 ++------------- .../pre_requisite_non_container_debian.yml | 14 ++++++------- .../pre_requisite_non_container_red_hat.yml | 5 +---- 5 files changed, 13 insertions(+), 49 deletions(-) diff --git a/infrastructure-playbooks/purge-docker-cluster.yml b/infrastructure-playbooks/purge-docker-cluster.yml index b9add86f3..7aebbf1d0 100644 --- a/infrastructure-playbooks/purge-docker-cluster.yml +++ b/infrastructure-playbooks/purge-docker-cluster.yml @@ -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 diff --git a/roles/ceph-docker-common/tasks/pre_requisites/debian_prerequisites.yml b/roles/ceph-docker-common/tasks/pre_requisites/debian_prerequisites.yml index a95b41325..3958a5188 100644 --- a/roles/ceph-docker-common/tasks/pre_requisites/debian_prerequisites.yml +++ b/roles/ceph-docker-common/tasks/pre_requisites/debian_prerequisites.yml @@ -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: diff --git a/roles/ceph-docker-common/tasks/pre_requisites/prerequisites.yml b/roles/ceph-docker-common/tasks/pre_requisites/prerequisites.yml index d28f7f0b5..e3d5f4a10 100644 --- a/roles/ceph-docker-common/tasks/pre_requisites/prerequisites.yml +++ b/roles/ceph-docker-common/tasks/pre_requisites/prerequisites.yml @@ -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 diff --git a/roles/ceph-nfs/tasks/pre_requisite_non_container_debian.yml b/roles/ceph-nfs/tasks/pre_requisite_non_container_debian.yml index b1c3d9a0a..21324116d 100644 --- a/roles/ceph-nfs/tasks/pre_requisite_non_container_debian.yml +++ b/roles/ceph-nfs/tasks/pre_requisite_non_container_debian.yml @@ -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' diff --git a/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml b/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml index bc4bd9169..d7ebcc389 100644 --- a/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml +++ b/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml @@ -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