From c4ffd39478751b56a5134cea59919488640fa6ef Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 25 Oct 2019 17:35:23 +0100 Subject: [PATCH] Switch to generic package module This makes platform independence easier. There are some cases where we still use the yum module, where we use yum-specific module parameters. Also switch use of the state 'installed' to 'present', which is supported by all the package modules, whereas installed is supported by the yum module only. Change-Id: Id1cf845adc7aa6565a7a570569c9a81a478560f0 --- ansible/compute-node-discovery.yml | 4 ++-- ansible/idrac-bootstrap.yml | 8 ++++---- ansible/kayobe-target-venv.yml | 4 ++-- ansible/kolla-target-venv.yml | 2 +- ansible/overcloud-host-image-workaround-cloud-init.yml | 2 +- ansible/overcloud-host-image-workaround-resolv.yml | 2 +- ansible/roles/bootstrap/tasks/main.yml | 2 +- ansible/roles/console-allocation/tasks/main.yml | 2 +- ansible/roles/dev-tools/tasks/main.yml | 4 ++-- ansible/roles/disable-selinux/tasks/main.yml | 4 ++-- ansible/roles/ip-allocation/tasks/main.yml | 2 +- ansible/roles/kolla-ansible/tasks/install.yml | 6 +++--- ansible/roles/kolla-ceph/tasks/config.yml | 2 +- ansible/roles/kolla/tasks/install.yml | 8 ++++---- ansible/roles/swift-block-devices/tasks/main.yml | 2 +- ansible/roles/wipe-disks/tasks/main.yml | 2 +- ansible/roles/yum/tasks/local-mirror.yml | 2 +- 17 files changed, 29 insertions(+), 29 deletions(-) diff --git a/ansible/compute-node-discovery.yml b/ansible/compute-node-discovery.yml index ce5de3ea0..dbc0d9d66 100644 --- a/ansible/compute-node-discovery.yml +++ b/ansible/compute-node-discovery.yml @@ -8,9 +8,9 @@ controller_host: "{{ groups['controllers'][0] }}" tasks: - name: Ensure ipmitool is installed - yum: + package: name: ipmitool - state: installed + state: present become: True run_once: True delegate_to: "{{ controller_host }}" diff --git a/ansible/idrac-bootstrap.yml b/ansible/idrac-bootstrap.yml index 17c28a177..5ff65f183 100644 --- a/ansible/idrac-bootstrap.yml +++ b/ansible/idrac-bootstrap.yml @@ -43,17 +43,17 @@ # Install Dell server admin tools. - block: - name: Ensure wget is installed - yum: + package: name: wget - state: installed + state: present - name: Ensure Dell srvadmin repository is installed shell: "wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash" - name: Ensure Dell srvadmin-idrac7 package is installed - yum: + package: name: srvadmin-idrac7 - state: installed + state: present # Configure access to the temporary network on a controller. - block: diff --git a/ansible/kayobe-target-venv.yml b/ansible/kayobe-target-venv.yml index 488ab7f82..344f2bf9e 100644 --- a/ansible/kayobe-target-venv.yml +++ b/ansible/kayobe-target-venv.yml @@ -28,7 +28,7 @@ - name: Ensure the python-virtualenv package is installed package: name: python-virtualenv - state: installed + state: present become: True - name: Ensure global virtualenv directory exists @@ -78,7 +78,7 @@ - name: Ensure the python-setuptools package is installed package: name: python-setuptools - state: installed + state: present become: True - name: Ensure pip is installed diff --git a/ansible/kolla-target-venv.yml b/ansible/kolla-target-venv.yml index af15dd443..a0eddbb5e 100644 --- a/ansible/kolla-target-venv.yml +++ b/ansible/kolla-target-venv.yml @@ -13,7 +13,7 @@ - name: Ensure the python-virtualenv package is installed package: name: python-virtualenv - state: installed + state: present become: True - name: Ensure kolla-ansible virtualenv has the latest version of pip installed diff --git a/ansible/overcloud-host-image-workaround-cloud-init.yml b/ansible/overcloud-host-image-workaround-cloud-init.yml index 94fd775da..c55b1c96b 100644 --- a/ansible/overcloud-host-image-workaround-cloud-init.yml +++ b/ansible/overcloud-host-image-workaround-cloud-init.yml @@ -18,7 +18,7 @@ --connection local --become -m yum - -a "name=libguestfs-tools state=installed"' + -a "name=libguestfs-tools state=present"' - name: Template cloud-init-repo copy: content: | diff --git a/ansible/overcloud-host-image-workaround-resolv.yml b/ansible/overcloud-host-image-workaround-resolv.yml index 665679519..16018ae54 100644 --- a/ansible/overcloud-host-image-workaround-resolv.yml +++ b/ansible/overcloud-host-image-workaround-resolv.yml @@ -21,7 +21,7 @@ --connection local --become -m yum - -a "name=libguestfs-tools state=installed"' + -a "name=libguestfs-tools state=present"' - name: Ensure the overcloud host image has bogus name server entries removed command: > diff --git a/ansible/roles/bootstrap/tasks/main.yml b/ansible/roles/bootstrap/tasks/main.yml index 4439aa15a..0c6221ba2 100644 --- a/ansible/roles/bootstrap/tasks/main.yml +++ b/ansible/roles/bootstrap/tasks/main.yml @@ -5,7 +5,7 @@ - name: Ensure required packages are installed package: name: "{{ bootstrap_package_dependencies }}" - state: installed + state: present become: True - name: Check whether an SSH key exists diff --git a/ansible/roles/console-allocation/tasks/main.yml b/ansible/roles/console-allocation/tasks/main.yml index 2d3da89c3..02587b34d 100644 --- a/ansible/roles/console-allocation/tasks/main.yml +++ b/ansible/roles/console-allocation/tasks/main.yml @@ -22,7 +22,7 @@ local_action: module: package name: "{{ item }}" - state: installed + state: present use: "{{ console_allocation_package_manager }}" become: True with_items: "{{ console_allocation_package_dependencies }}" diff --git a/ansible/roles/dev-tools/tasks/main.yml b/ansible/roles/dev-tools/tasks/main.yml index 6294b6a09..51dc00688 100644 --- a/ansible/roles/dev-tools/tasks/main.yml +++ b/ansible/roles/dev-tools/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Ensure required packages are installed - yum: + package: name: "{{ dev_tools_packages }}" - state: installed + state: present become: True diff --git a/ansible/roles/disable-selinux/tasks/main.yml b/ansible/roles/disable-selinux/tasks/main.yml index 0de9956f1..f9b06a9db 100644 --- a/ansible/roles/disable-selinux/tasks/main.yml +++ b/ansible/roles/disable-selinux/tasks/main.yml @@ -1,9 +1,9 @@ --- - name: Ensure required packages are installed - yum: + package: name: - libselinux-python - state: installed + state: present become: True - name: Ensure SELinux is disabled diff --git a/ansible/roles/ip-allocation/tasks/main.yml b/ansible/roles/ip-allocation/tasks/main.yml index f2dfa9e3c..a5a71dd2d 100644 --- a/ansible/roles/ip-allocation/tasks/main.yml +++ b/ansible/roles/ip-allocation/tasks/main.yml @@ -22,7 +22,7 @@ local_action: module: package name: "{{ item }}" - state: installed + state: present use: "{{ ip_allocation_package_manager }}" become: True with_items: "{{ ip_allocation_package_dependencies }}" diff --git a/ansible/roles/kolla-ansible/tasks/install.yml b/ansible/roles/kolla-ansible/tasks/install.yml index 12356e7a6..334961178 100644 --- a/ansible/roles/kolla-ansible/tasks/install.yml +++ b/ansible/roles/kolla-ansible/tasks/install.yml @@ -3,9 +3,9 @@ include_vars: "{{ ansible_os_family }}.yml" - name: Ensure EPEL repo is installed - yum: + package: name: epel-release - state: installed + state: present become: True when: - ansible_os_family == 'RedHat' @@ -14,7 +14,7 @@ - name: Ensure required packages are installed package: name: "{{ kolla_ansible_package_dependencies }}" - state: installed + state: present become: True - name: Ensure source code checkout parent directory exists diff --git a/ansible/roles/kolla-ceph/tasks/config.yml b/ansible/roles/kolla-ceph/tasks/config.yml index 3a518ee58..9325c3818 100644 --- a/ansible/roles/kolla-ceph/tasks/config.yml +++ b/ansible/roles/kolla-ceph/tasks/config.yml @@ -3,7 +3,7 @@ - name: Ensure required packages are installed package: name: parted - state: installed + state: present become: True when: ceph_disks | length > 0 diff --git a/ansible/roles/kolla/tasks/install.yml b/ansible/roles/kolla/tasks/install.yml index 69b239504..69ac843c8 100644 --- a/ansible/roles/kolla/tasks/install.yml +++ b/ansible/roles/kolla/tasks/install.yml @@ -1,15 +1,15 @@ --- - name: Ensure EPEL repo is installed - yum: + package: name: epel-release - state: installed + state: present become: True when: - ansible_os_family == 'RedHat' - kolla_install_epel | bool - name: Ensure required packages are installed - yum: + package: name: - gcc - libffi-devel @@ -17,7 +17,7 @@ - python-devel - python-pip - python-virtualenv - state: installed + state: present become: True - name: Ensure source code checkout path exists diff --git a/ansible/roles/swift-block-devices/tasks/main.yml b/ansible/roles/swift-block-devices/tasks/main.yml index 658739b69..0fd1a4f10 100644 --- a/ansible/roles/swift-block-devices/tasks/main.yml +++ b/ansible/roles/swift-block-devices/tasks/main.yml @@ -14,7 +14,7 @@ name: - parted - xfsprogs - state: installed + state: present become: True when: swift_block_devices | length > 0 diff --git a/ansible/roles/wipe-disks/tasks/main.yml b/ansible/roles/wipe-disks/tasks/main.yml index b44095f95..1856c8708 100644 --- a/ansible/roles/wipe-disks/tasks/main.yml +++ b/ansible/roles/wipe-disks/tasks/main.yml @@ -7,7 +7,7 @@ # any LVM or file system state from them. - name: Ensure LVM2 is installed - yum: + package: name: lvm2 state: present become: True diff --git a/ansible/roles/yum/tasks/local-mirror.yml b/ansible/roles/yum/tasks/local-mirror.yml index 02557a00f..e730b007d 100644 --- a/ansible/roles/yum/tasks/local-mirror.yml +++ b/ansible/roles/yum/tasks/local-mirror.yml @@ -24,7 +24,7 @@ - name: Yum | Install epel-release (CentOS) yum: name: epel-release - state: installed + state: present become: True - name: Template | Copy EPEL repo templates (CentOS)