From 6361372415da731d1595a965fd47bb5bdabbdb07 Mon Sep 17 00:00:00 2001 From: Logan V Date: Wed, 2 Nov 2016 12:48:25 +0000 Subject: [PATCH] Fix linting issues for ansible-lint 3.4.1 Preparing this role for the ansible-lint version bump Change-Id: Ia5d254d43f9541c82c700080aafee276dafad0a7 --- defaults/main.yml | 3 ++- handlers/main.yml | 3 +-- tasks/main.yml | 4 +++- tasks/nova_compute_ironic.yml | 2 +- tasks/nova_compute_kvm.yml | 3 ++- tasks/nova_compute_kvm_install.yml | 5 +++-- tasks/nova_compute_kvm_virsh_net_remove.yml | 1 + tasks/nova_compute_lxd_install.yml | 2 +- tasks/nova_compute_powervm.yml | 3 ++- tasks/nova_compute_powervm_install.yml | 5 ++++- tasks/nova_console_novnc_install.yml | 2 +- tasks/nova_console_novnc_ssl.yml | 1 + tasks/nova_db_setup.yml | 3 +++ tasks/nova_install.yml | 4 ++-- tasks/nova_virt_detect.yml | 2 +- 15 files changed, 28 insertions(+), 15 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index c0329eb4..a4a8c5cb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -19,9 +19,10 @@ nova_ceilometer_enabled: False ## Verbosity Options debug: False -# Set the package install state for distribution packages +# Set the package install state for distribution and pip packages # Options are 'present' and 'latest' nova_package_state: "latest" +nova_pip_package_state: "latest" nova_git_repo: https://git.openstack.org/openstack/nova nova_git_install_branch: master diff --git a/handlers/main.yml b/handlers/main.yml index 9882e6c8..2ce4e395 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -25,8 +25,7 @@ - Restart nova services - name: Reload upstart init scripts - shell: | - initctl reload-configuration + command: initctl reload-configuration notify: - Restart nova services diff --git a/tasks/main.yml b/tasks/main.yml index 56e21b77..e9a264c4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -16,6 +16,7 @@ # Detect whether the init system is upstart of systemd. - name: Check init system command: cat /proc/1/comm + changed_when: false register: _pid1_name tags: - always @@ -37,7 +38,8 @@ tags: - always -- fail: msg="Unsupported Virt Type Provided {{ nova_supported_virt_types }}" +- name: Fail when virt type is unsupported + fail: msg="Unsupported Virt Type Provided {{ nova_supported_virt_types }}" when: - nova_virt_type is defined - nova_virt_type not in nova_supported_virt_types diff --git a/tasks/nova_compute_ironic.yml b/tasks/nova_compute_ironic.yml index 74ad353d..08169f7f 100644 --- a/tasks/nova_compute_ironic.yml +++ b/tasks/nova_compute_ironic.yml @@ -16,7 +16,7 @@ - name: Install pip packages (venv) pip: name: "{{ nova_compute_ironic_pip_packages | join(' ') }}" - state: latest + state: "{{ nova_pip_package_state }}" virtualenv: "{{ nova_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options_fact|default('') }}" diff --git a/tasks/nova_compute_kvm.yml b/tasks/nova_compute_kvm.yml index 498e8fa9..3f7efc31 100644 --- a/tasks/nova_compute_kvm.yml +++ b/tasks/nova_compute_kvm.yml @@ -24,7 +24,8 @@ - nova-libvirt - name: Ensure kvm permissions - shell: "udevadm trigger" + command: "udevadm trigger" + changed_when: false tags: - nova-kvm diff --git a/tasks/nova_compute_kvm_install.yml b/tasks/nova_compute_kvm_install.yml index 6697ce01..b946a2f8 100644 --- a/tasks/nova_compute_kvm_install.yml +++ b/tasks/nova_compute_kvm_install.yml @@ -22,7 +22,8 @@ register: _qemu_save_dir - name: Check if the qemu save directory is empty - shell: 'ls -1A /var/lib/libvirt/qemu/save' + command: 'ls -1A /var/lib/libvirt/qemu/save' + changed_when: false register: _qemu_save_dir_contents - name: Move the existing save directory to nova_libvirt_save_path @@ -48,7 +49,7 @@ - name: Install pip packages pip: name: "{{ nova_compute_pip_packages | join(' ') }}" - state: latest + state: "{{ nova_pip_package_state }}" virtualenv: "{{ nova_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options|default('') }}" diff --git a/tasks/nova_compute_kvm_virsh_net_remove.yml b/tasks/nova_compute_kvm_virsh_net_remove.yml index 2eb3410a..873e4ba1 100644 --- a/tasks/nova_compute_kvm_virsh_net_remove.yml +++ b/tasks/nova_compute_kvm_virsh_net_remove.yml @@ -15,6 +15,7 @@ - name: Check for libvirt default network shell: "virsh net-list | awk '/default/'" + changed_when: false register: default_net tags: - nova-kvm diff --git a/tasks/nova_compute_lxd_install.yml b/tasks/nova_compute_lxd_install.yml index f2cafce6..a1cbc082 100644 --- a/tasks/nova_compute_lxd_install.yml +++ b/tasks/nova_compute_lxd_install.yml @@ -16,7 +16,7 @@ - name: Install pip packages (venv) pip: name: "{{ nova_compute_lxd_pip_packages | join(' ') }}" - state: latest + state: "{{ nova_pip_package_state }}" virtualenv: "{{ nova_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options_fact|default('') }}" diff --git a/tasks/nova_compute_powervm.yml b/tasks/nova_compute_powervm.yml index f71b40bf..2955c856 100644 --- a/tasks/nova_compute_powervm.yml +++ b/tasks/nova_compute_powervm.yml @@ -24,6 +24,7 @@ - nova-powervm - name: Ensure powervm permissions - shell: "udevadm trigger" + command: "udevadm trigger" + changed_when: false tags: - nova-powervm diff --git a/tasks/nova_compute_powervm_install.yml b/tasks/nova_compute_powervm_install.yml index 02599877..50765a59 100644 --- a/tasks/nova_compute_powervm_install.yml +++ b/tasks/nova_compute_powervm_install.yml @@ -56,6 +56,8 @@ tags: - nova-apt-packages - nova-compute-powervm-apt-packages + # do not trigger ANSIBLE0016 + - skip_ansible_lint - name: Install apt packages apt: @@ -72,6 +74,7 @@ - name: Register pypowervm module path (venv) command: python -c 'import pypowervm; print pypowervm.__file__' + changed_when: false register: pypowervm_module_path tags: - nova-powervm-libs @@ -88,7 +91,7 @@ - name: Install pip packages pip: name: "{{ nova_compute_powervm_pip_packages | join(' ') }}" - state: latest + state: "{{ nova_pip_package_state }}" virtualenv: "{{ nova_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options|default('') }}" diff --git a/tasks/nova_console_novnc_install.yml b/tasks/nova_console_novnc_install.yml index a7e053c2..238ddcac 100644 --- a/tasks/nova_console_novnc_install.yml +++ b/tasks/nova_console_novnc_install.yml @@ -41,7 +41,7 @@ - name: Install pip packages pip: name: "{{ nova_novnc_pip_packages | join(' ') }}" - state: latest + state: "{{ nova_pip_package_state }}" virtualenv: "{{ nova_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options|default('') }}" diff --git a/tasks/nova_console_novnc_ssl.yml b/tasks/nova_console_novnc_ssl.yml index 003fcaaa..93f5bb69 100644 --- a/tasks/nova_console_novnc_ssl.yml +++ b/tasks/nova_console_novnc_ssl.yml @@ -23,6 +23,7 @@ - name: Prepare combined nova-console SSL and CA certs local_action: command cat {{ nova_console_user_ssl_cert }} {{ nova_console_user_ssl_ca_cert is defined | ternary(nova_console_user_ssl_ca_cert,'') }} + changed_when: false register: nova_console_user_ssl_combined - name: Drop user provided ssl cert and key diff --git a/tasks/nova_db_setup.yml b/tasks/nova_db_setup.yml index f53e4672..89d48fa8 100644 --- a/tasks/nova_db_setup.yml +++ b/tasks/nova_db_setup.yml @@ -17,6 +17,7 @@ command: "{{ nova_bin }}/nova-manage db sync" become: yes become_user: "{{ nova_system_user_name }}" + changed_when: false tags: - nova-db-setup - nova-setup @@ -26,6 +27,7 @@ command: "{{ nova_bin }}/nova-manage api_db sync" become: yes become_user: "{{ nova_system_user_name }}" + changed_when: false tags: - nova-db-setup - nova-setup @@ -35,6 +37,7 @@ command: "{{ nova_bin }}/nova-manage db online_data_migrations" become: yes become_user: "{{ nova_system_user_name }}" + changed_when: false tags: - nova-db-setup - nova-setup diff --git a/tasks/nova_install.yml b/tasks/nova_install.yml index 6e91cab0..0e998644 100644 --- a/tasks/nova_install.yml +++ b/tasks/nova_install.yml @@ -63,7 +63,7 @@ - name: Install requires pip packages pip: name: "{{ nova_requires_pip_packages | join(' ') }}" - state: latest + state: "{{ nova_pip_package_state }}" extra_args: "{{ pip_install_options_fact }}" register: install_packages until: install_packages|success @@ -157,7 +157,7 @@ - name: Install pip packages pip: name: "{{ nova_pip_packages | join(' ') }}" - state: latest + state: "{{ nova_pip_package_state }}" virtualenv: "{{ nova_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options_fact }}" diff --git a/tasks/nova_virt_detect.yml b/tasks/nova_virt_detect.yml index e151332d..891be44e 100644 --- a/tasks/nova_virt_detect.yml +++ b/tasks/nova_virt_detect.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Get CPU info content and store as var - shell: cat /proc/cpuinfo + command: cat /proc/cpuinfo register: cpuinfo_contents changed_when: false failed_when: false