Update when syntax and fix deprecation warnings
When conditionals are converted into list if they're interpreted as a string. This change converts our use of "when" to simply be a list which will save cycles internally. This also corrects the deprecation warning to use "is" instead of the filter "|" within a conditional. Change-Id: I6e4ccbcf3d2b443c9121f660bcbb64a1824887bf Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
ef9c4f1ea5
commit
31e1195666
|
@ -19,7 +19,8 @@
|
|||
Wrong kernel Version found
|
||||
[ {{ ansible_kernel }} < {{ openstack_host_required_kernel }} ]
|
||||
Resolve this issue before continuing.
|
||||
when: ansible_kernel | version_compare(openstack_host_required_kernel, '<')
|
||||
when:
|
||||
- ansible_kernel | version_compare(openstack_host_required_kernel, '<')
|
||||
|
||||
- name: Disable cache for apt update for hosts
|
||||
copy:
|
||||
|
@ -49,7 +50,8 @@
|
|||
slurp:
|
||||
src: "/boot/config-{{ ansible_kernel }}"
|
||||
register: modules
|
||||
when: openstack_host_specific_kernel_modules | length > 0
|
||||
when:
|
||||
- openstack_host_specific_kernel_modules | length > 0
|
||||
|
||||
- name: Fail fast if we can't load a module
|
||||
fail:
|
||||
|
@ -84,7 +86,8 @@
|
|||
|
||||
- name: Configure sysstat
|
||||
include_tasks: openstack_sysstat.yml
|
||||
when: openstack_host_sysstat_enabled | bool
|
||||
when:
|
||||
- openstack_host_sysstat_enabled | bool
|
||||
|
||||
- name: Create a directory to hold systemd journals on disk
|
||||
file:
|
||||
|
@ -100,7 +103,7 @@
|
|||
- name: Create tmpfiles structure in journald directory
|
||||
command: systemd-tmpfiles --create --prefix /var/log/journal
|
||||
when:
|
||||
- journald_directory | changed
|
||||
- journald_directory is changed
|
||||
- openstack_host_keep_journals | bool
|
||||
notify:
|
||||
- Restart systemd-journald
|
||||
|
|
|
@ -50,7 +50,8 @@
|
|||
# Configure host files should apply to all nodes
|
||||
- name: Configure etc hosts files
|
||||
include_tasks: openstack_update_hosts_file.yml
|
||||
when: openstack_host_manage_hosts_file | bool
|
||||
when:
|
||||
- openstack_host_manage_hosts_file | bool
|
||||
tags:
|
||||
- openstack_hosts-config
|
||||
|
||||
|
@ -72,7 +73,8 @@
|
|||
package:
|
||||
name: "{{ openstack_host_distro_packages }}"
|
||||
state: "{{ openstack_hosts_package_state }}"
|
||||
when: openstack_host_distro_packages | length > 0
|
||||
when:
|
||||
- openstack_host_distro_packages | length > 0
|
||||
register: install_packages
|
||||
until: install_packages | success
|
||||
retries: 5
|
||||
|
|
|
@ -27,4 +27,5 @@
|
|||
state: present
|
||||
key: "{{ item }}"
|
||||
with_url: "{{ ssh_key_url }}"
|
||||
when: ssh_key_url is defined
|
||||
when:
|
||||
- ssh_key_url is defined
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
- name: Add/Remove repositories gpg keys manually
|
||||
apt_key:
|
||||
id: "{{ key.id | default(omit) }}"
|
||||
data: "{{ key.data | default(omit) }}" # use lookup('file','armored_content.asc')
|
||||
data: "{{ key.data | default(omit) }}"
|
||||
keyserver: "{{ key.keyserver | default(omit) }}"
|
||||
url: "{{ key.url | default(omit) }}"
|
||||
state: "{{ key.state | default('present') }}"
|
||||
|
@ -72,7 +72,8 @@
|
|||
- name: Update Apt cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
when: _adding_apt_repo | changed
|
||||
when:
|
||||
- _adding_apt_repo is changed
|
||||
register: _update_apt_cache
|
||||
until: _update_apt_cache | success
|
||||
changed_when: false
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
regexp: '^BACKGROUND_COMPARISON=.*'
|
||||
line: 'BACKGROUND_COMPARISON="no"'
|
||||
state: present
|
||||
when: snapper_root_config.stat.exists
|
||||
when:
|
||||
- snapper_root_config.stat.exists
|
||||
|
||||
- name: Remove the blacklisted packages
|
||||
package:
|
||||
|
@ -59,7 +60,8 @@
|
|||
zypper:
|
||||
name: "{{ openstack_hosts_package_list | rejectattr('state','equalto','absent') | map(attribute='name') | list }}"
|
||||
state: "{{ openstack_hosts_package_state }}"
|
||||
when: "openstack_hosts_package_list | rejectattr('state','equalto','absent') | map(attribute='name') | list | length > 0"
|
||||
when:
|
||||
- (openstack_hosts_package_list | rejectattr('state','equalto','absent') | map(attribute='name') | list | length) > 0
|
||||
|
||||
- name: Add/Remove/Update standard and user defined repositories
|
||||
zypper_repository:
|
||||
|
@ -84,4 +86,5 @@
|
|||
zypper_repository:
|
||||
repo: '*'
|
||||
runrefresh: yes
|
||||
when: _adding_repo | changed
|
||||
when:
|
||||
- _adding_repo | changed
|
||||
|
|
|
@ -19,10 +19,12 @@
|
|||
dest: "{{ openstack_distrib_file_path }}"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
when: openstack_distrib_file | bool
|
||||
when:
|
||||
- openstack_distrib_file | bool
|
||||
|
||||
- name: Remove legacy openstack release file
|
||||
file:
|
||||
path: "{{ openstack_distrib_file_path }}"
|
||||
state: absent
|
||||
when: not openstack_distrib_file | bool
|
||||
when:
|
||||
- not openstack_distrib_file | bool
|
||||
|
|
Loading…
Reference in New Issue