]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
don't loop over a task using package management modules
authorRishabh Dave <ridave@redhat.com>
Wed, 31 Oct 2018 16:07:25 +0000 (12:07 -0400)
committermergify[bot] <mergify[bot]@users.noreply.github.com>
Thu, 8 Nov 2018 08:38:10 +0000 (08:38 +0000)
For tasks using (Ansible) modules for package management utilities,
pass the list of packages to be installed instead of repeating the task
for each package. Using the latter manner of installing a list of
packages leads to a deprecation warning by ansible-playbook command.

Fixes: https://github.com/ceph/ceph-ansible/issues/3293
Signed-off-by: Rishabh Dave <ridave@redhat.com>
infrastructure-playbooks/purge-cluster.yml
infrastructure-playbooks/purge-docker-cluster.yml

index 23295b8f6394c34693fccd8eef7ecceda38be7fe..ccc8e6b0c5417be10b70e9ce521b9d3ae23c695e 100644 (file)
 
   - name: purge ceph packages with yum
     yum:
-      name: "{{ item }}"
+      name: "{{ ceph_packages }}"
       state: absent
-    with_items: "{{ ceph_packages }}"
     when: ansible_pkg_mgr == 'yum'
 
   - name: purge ceph packages with dnf
     dnf:
-      name: "{{ item }}"
+      name: "{{ ceph_packages }}"
       state: absent
-    with_items: "{{ ceph_packages }}"
     when: ansible_pkg_mgr == 'dnf'
 
   - name: purge ceph packages with apt
     apt:
-      name: "{{ item }}"
+      name: "{{ ceph_packages }}"
       state: absent
       purge: true
-    with_items: "{{ ceph_packages }}"
     when: ansible_pkg_mgr == 'apt'
 
   - name: purge remaining ceph packages with yum
     yum:
-      name: "{{ item }}"
+      name: "{{ ceph_remaining_packages }}"
       state: absent
-    with_items: "{{ ceph_remaining_packages }}"
     when:
       - ansible_pkg_mgr == 'yum'
       - purge_all_packages == true
 
   - name: purge remaining ceph packages with dnf
     dnf:
-      name: "{{ item }}"
+      name: "{{ ceph_remaining_packages }}"
       state: absent
-    with_items: "{{ ceph_remaining_packages }}"
     when:
       - ansible_pkg_mgr == 'dnf'
       - purge_all_packages == true
 
   - name: purge remaining ceph packages with apt
     apt:
-      name: "{{ item }}"
+      name: "{{ ceph_remaining_packages }}"
       state: absent
-    with_items: "{{ ceph_remaining_packages }}"
     when:
       - ansible_pkg_mgr == 'apt'
       - purge_all_packages == true
index 2a87d1f5b584cb89219326098bbe875f422e5e30..b9add86f3050baec0b813c53027408279dbfe81a 100644 (file)
 
       - name: remove pip and docker on debian
         apt:
-          name: "{{ item }}"
+          name: [python-pip, docker-engine]
           state: absent
           update_cache: yes
           autoremove: yes
-        with_items:
-          - python-pip
-          - docker-engine
     when: ansible_distribution == 'Debian'
 
   - name: remove pip and docker on ubuntu
     apt:
-      name: "{{ item }}"
+      name: [python-pip, docker, docker.io]
       state: absent
       update_cache: yes
       autoremove: yes
-    with_items:
-      - python-pip
-      - docker
-      - docker.io
     when: ansible_distribution == 'Ubuntu'
 
   - name: red hat based systems tasks
         block:
           - name: remove pip on redhat
             yum:
-              name: "{{ item }}"
+              name: python-pip
               state: absent
-            with_items:
-              - python-pip
 
           - name: remove docker-engine on redhat
             yum:
-              name: "{{ item }}"
+              name: docker-engine
               state: absent
-            with_items:
-              - docker-engine
 
           # for CentOS
           - name: remove docker on redhat
             yum:
-              name: "{{ item }}"
+              name: docker
               state: absent
-            with_items:
-              - docker
 
           - name: remove package dependencies on redhat
             command: yum -y autoremove
         block:
           - name: remove pip and docker on redhat
             dnf:
-              name: "{{ item }}"
+              name: [python-pip, docker-engine, docker]
               state: absent
-            with_items:
-              - python-pip
-              - docker-engine
-              - docker
 
           - name: remove package dependencies on redhat
             command: dnf -y autoremove