From 2ba5dd43c2e87782c11426b2d3aa4df3586ed760 Mon Sep 17 00:00:00 2001 From: Logan V Date: Wed, 2 Nov 2016 02:31:54 +0000 Subject: [PATCH] Fix linting issues for ansible-lint 3.4.1 Preparing this role for the ansible-lint version bump Change-Id: I63aa87f0b225e7fab576af2b4819b0be6e2184ca --- defaults/main.yml | 3 ++- tasks/keystone_credential_distribute.yml | 15 ++++++++++----- tasks/keystone_db_setup.yml | 1 + tasks/keystone_federation_sp_setup.yml | 3 ++- tasks/keystone_fernet_keys_distribute.yml | 15 ++++++++++----- tasks/keystone_init_upstart.yml | 4 ++-- tasks/keystone_install.yml | 4 ++-- tasks/keystone_service_setup.yml | 1 + tasks/main.yml | 1 + 9 files changed, 31 insertions(+), 16 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 5907b4d2..e81020a5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -16,9 +16,10 @@ ## 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' keystone_package_state: "latest" +keystone_pip_package_state: "latest" # Role standard API override this option in the OS variable files keystone_shibboleth_repo: {} diff --git a/tasks/keystone_credential_distribute.yml b/tasks/keystone_credential_distribute.yml index 8af20fae..d767314b 100644 --- a/tasks/keystone_credential_distribute.yml +++ b/tasks/keystone_credential_distribute.yml @@ -13,13 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +# TODO(logan): Change to synchronize module to pass ANSIBLE0006 +# and remove the skip_ansible_lint tag at that time. - name: Distribute the credential key repository - shell: | - rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \ - -avz \ - --delete \ - {{ keystone_credential_key_repository }}/ \ + command: > + rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' + -avz + --delete + {{ keystone_credential_key_repository }}/ {{ keystone_system_user_name }}@{{ hostvars[item]['ansible_host'] }}:{{ keystone_credential_key_repository }}/ become: yes become_user: "{{ keystone_system_user_name }}" + changed_when: false with_items: "{{ groups['keystone_all'][1:] }}" + tags: + - skip_ansible_lint diff --git a/tasks/keystone_db_setup.yml b/tasks/keystone_db_setup.yml index 490280dc..e5714990 100644 --- a/tasks/keystone_db_setup.yml +++ b/tasks/keystone_db_setup.yml @@ -15,5 +15,6 @@ - name: Perform a Keystone DB sync command: "{{ keystone_bin }}/keystone-manage db_sync" + changed_when: false become: yes become_user: "{{ keystone_system_user_name }}" diff --git a/tasks/keystone_federation_sp_setup.yml b/tasks/keystone_federation_sp_setup.yml index f28ce0ac..f0c39070 100644 --- a/tasks/keystone_federation_sp_setup.yml +++ b/tasks/keystone_federation_sp_setup.yml @@ -27,9 +27,10 @@ - Restart Shibd - name: Generate the Shibboleth SP key-pair - shell: "shib-keygen -h {{ external_lb_vip_address }} -y {{ keystone_sp.cert_duration_years }}" + command: "shib-keygen -h {{ external_lb_vip_address }} -y {{ keystone_sp.cert_duration_years }}" args: creates: "/etc/shibboleth/sp-cert.pem" + changed_when: false when: inventory_hostname == groups['keystone_all'][0] notify: - Restart service diff --git a/tasks/keystone_fernet_keys_distribute.yml b/tasks/keystone_fernet_keys_distribute.yml index 92d342d2..052d3ce6 100644 --- a/tasks/keystone_fernet_keys_distribute.yml +++ b/tasks/keystone_fernet_keys_distribute.yml @@ -13,13 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +# TODO(logan): Change to synchronize module to pass ANSIBLE0006 +# and remove the skip_ansible_lint tag at that time. - name: Distribute the fernet key repository - shell: | - rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \ - -avz \ - --delete \ - {{ keystone_fernet_tokens_key_repository }}/ \ + command: > + rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' + -avz + --delete + {{ keystone_fernet_tokens_key_repository }}/ {{ keystone_system_user_name }}@{{ hostvars[item]['ansible_host'] }}:{{ keystone_fernet_tokens_key_repository }}/ become: yes become_user: "{{ keystone_system_user_name }}" + changed_when: false with_items: "{{ groups['keystone_all'][1:] }}" + tags: + - skip_ansible_lint diff --git a/tasks/keystone_init_upstart.yml b/tasks/keystone_init_upstart.yml index 39f51a50..69c7d443 100644 --- a/tasks/keystone_init_upstart.yml +++ b/tasks/keystone_init_upstart.yml @@ -24,8 +24,8 @@ notify: Restart Keystone APIs - name: Reload init scripts - shell: | - initctl reload-configuration + command: initctl reload-configuration + changed_when: false when: upstart_init | changed notify: - Restart Keystone APIs diff --git a/tasks/keystone_install.yml b/tasks/keystone_install.yml index d39b3e2f..1bc98d1c 100644 --- a/tasks/keystone_install.yml +++ b/tasks/keystone_install.yml @@ -45,7 +45,7 @@ - name: Install required pip packages pip: name: "{{ keystone_requires_pip_packages | join(' ') }}" - state: latest + state: "{{ keystone_pip_package_state }}" extra_args: >- {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }} {{ pip_install_options | default('') }} @@ -121,7 +121,7 @@ - name: Install pip packages pip: name: "{{ keystone_pip_packages | join(' ') }}" - state: latest + state: "{{ keystone_pip_package_state }}" virtualenv: "{{ keystone_bin | dirname }}" virtualenv_site_packages: "no" extra_args: >- diff --git a/tasks/keystone_service_setup.yml b/tasks/keystone_service_setup.yml index 0ee2821f..d0948b4a 100644 --- a/tasks/keystone_service_setup.yml +++ b/tasks/keystone_service_setup.yml @@ -41,6 +41,7 @@ --bootstrap-internal-url {{ keystone_service_internalurl }} become: yes become_user: "{{ keystone_system_user_name }}" + changed_when: false register: add_service until: add_service|success retries: 5 diff --git a/tasks/main.yml b/tasks/main.yml index 3ae4263a..24f9fb73 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -44,6 +44,7 @@ - name: Check init system command: cat /proc/1/comm + changed_when: false register: _pid1_name tags: - always