Address Ansible bare variable usage
When executing the role with Ansible 2.1, the following deprecation warning is issued in the output for some tasks. [DEPRECATION WARNING]: Using bare variables is deprecated. This patch addresses the tasks to fix the behaviour appropriately. Also removed a single usage of with_items that contained one item in favor of a simple non-looping task. Change-Id: Ief1a53bb0804dfdbd742bfe919438d80428287da
This commit is contained in:
parent
3869f7b044
commit
5140edef3e
@ -19,7 +19,7 @@
|
||||
state: "restarted"
|
||||
pattern: "{{ item }}"
|
||||
register: service_restart
|
||||
with_items: swift_account_program_names
|
||||
with_items: "{{ swift_account_program_names }}"
|
||||
failed_when: false
|
||||
|
||||
- name: Restart swift container services
|
||||
@ -28,7 +28,7 @@
|
||||
state: "restarted"
|
||||
pattern: "{{ item }}"
|
||||
register: service_restart
|
||||
with_items: swift_container_program_names
|
||||
with_items: "{{ swift_container_program_names }}"
|
||||
failed_when: false
|
||||
|
||||
- name: Restart swift object services
|
||||
@ -37,7 +37,7 @@
|
||||
state: "restarted"
|
||||
pattern: "{{ item }}"
|
||||
register: service_restart
|
||||
with_items: swift_object_program_names
|
||||
with_items: "{{ swift_object_program_names }}"
|
||||
failed_when: false
|
||||
|
||||
- name: Restart swift proxy services
|
||||
@ -46,7 +46,7 @@
|
||||
state: "restarted"
|
||||
pattern: "{{ item }}"
|
||||
register: service_restart
|
||||
with_items: swift_proxy_program_names
|
||||
with_items: "{{ swift_proxy_program_names }}"
|
||||
failed_when: false
|
||||
|
||||
- name: Restart service
|
||||
|
@ -38,7 +38,7 @@
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: swift_apt_packages
|
||||
with_items: "{{ swift_apt_packages }}"
|
||||
tags:
|
||||
- swift-install
|
||||
- swift-apt-packages
|
@ -56,6 +56,15 @@
|
||||
tags:
|
||||
- swift-setup
|
||||
|
||||
# We need swift_vars to exist for the "swift_vars.drives is defined check" to work
|
||||
- name: "Set swift_vars if undefined"
|
||||
set_fact:
|
||||
swift_vars: "{}"
|
||||
when: swift_vars is not defined
|
||||
tags:
|
||||
- swift-storage-hosts
|
||||
- swift-setup
|
||||
|
||||
- include: swift_storage_hosts.yml
|
||||
when:
|
||||
- inventory_hostname in groups['swift_hosts']
|
||||
@ -69,7 +78,7 @@
|
||||
- inventory_hostname in groups['swift_proxy']
|
||||
- swift_do_setup | bool
|
||||
tags:
|
||||
- swift-storage-hosts
|
||||
- swift-proxy-hosts
|
||||
- swift-setup
|
||||
|
||||
- include: swift_service_setup.yml
|
||||
|
@ -72,7 +72,7 @@
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: swift_requires_pip_packages
|
||||
with_items: "{{ swift_requires_pip_packages }}"
|
||||
tags:
|
||||
- swift-install
|
||||
- swift-pip-packages
|
||||
@ -178,7 +178,7 @@
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: swift_pip_packages
|
||||
with_items: "{{ swift_pip_packages }}"
|
||||
when:
|
||||
- not swift_pypy_enabled | bool
|
||||
- swift_get_venv | failed or swift_developer_mode | bool
|
||||
|
@ -17,8 +17,10 @@
|
||||
authorized_key:
|
||||
user: "{{ swift_system_user_name }}"
|
||||
key: "{{ hostvars[item]['swift_pubkey'] | b64decode }}"
|
||||
with_items: groups['swift_all'] + groups['swift_remote_all']
|
||||
when: hostvars[item]['swift_pubkey'] is defined
|
||||
with_items: "{{ groups['swift_all'] + groups['swift_remote_all'] }}"
|
||||
when:
|
||||
- hostvars[item] is defined
|
||||
- hostvars[item]['swift_pubkey'] is defined
|
||||
tags:
|
||||
- swift-key
|
||||
- swift-key-create
|
||||
|
@ -46,12 +46,10 @@
|
||||
|
||||
- name: Copy swift config
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
src: "swift-rsyslog.conf.j2"
|
||||
dest: "/etc/rsyslog.d/49-swift.conf"
|
||||
owner: "{{ swift_system_user_name }}"
|
||||
group: "{{ swift_system_group_name }}"
|
||||
with_items:
|
||||
- { src: "swift-rsyslog.conf.j2", dest: "/etc/rsyslog.d/49-swift.conf" }
|
||||
notify:
|
||||
- Restart swift account services
|
||||
- Restart swift container services
|
||||
|
@ -35,9 +35,11 @@
|
||||
"The builder files on the remote host {{ item }}:{{ hostvars[item]['builder_md5sum'] }}
|
||||
do not match {{ inventory_hostname }}:{{ md5sum.stdout }}
|
||||
and are not empty on the remote host"
|
||||
when: >
|
||||
("{{ hostvars[item]['builder_md5sum'] }}" != "{{ empty_md5sum.stdout }}") and
|
||||
("{{ hostvars[item]['builder_md5sum'] }}" != "{{ md5sum.stdout }}")
|
||||
with_items: groups['swift_all'] + groups['swift_remote_all']
|
||||
when:
|
||||
- hostvars[item] is defined
|
||||
- hostvars[item]['builder_md5sum'] is defined
|
||||
- hostvars[item]['builder_md5sum'] != empty_md5sum.stdout
|
||||
- hostvars[item]['builder_md5sum'] != md5sum.stdout
|
||||
with_items: "{{ groups['swift_all'] + groups['swift_remote_all'] }}"
|
||||
tags:
|
||||
- swift-ring-check
|
||||
|
@ -26,12 +26,6 @@
|
||||
sysctl_set: yes
|
||||
delegate_to: "{{ physical_host }}"
|
||||
|
||||
# We need swift_vars to exist for the "swift_vars.drives is defined check" to work
|
||||
- name: "Set swift_vars if undefined"
|
||||
set_fact:
|
||||
swift_vars: "{}"
|
||||
when: swift_vars is not defined
|
||||
|
||||
- name: "Put /etc/rsyncd.conf in place"
|
||||
template:
|
||||
src: "rsyncd.conf.j2"
|
||||
@ -62,14 +56,4 @@
|
||||
owner: "{{ swift_system_user_name }}"
|
||||
group: "{{ swift_system_group_name }}"
|
||||
state: "directory"
|
||||
with_items: swift_vars.drives
|
||||
when: swift_vars.drives is defined
|
||||
|
||||
- name: "Set ownership on default mounted drives"
|
||||
file:
|
||||
dest: "{{ swift_vars.mount_point | default(swift.mount_point) }}/{{ item.name }}"
|
||||
owner: "{{ swift_system_user_name }}"
|
||||
group: "{{ swift_system_group_name }}"
|
||||
state: "directory"
|
||||
with_items: swift.drives
|
||||
when: swift_vars.drives is not defined
|
||||
with_items: "{{ swift_vars.drives| default(swift.drives) | default([]) }}"
|
||||
|
@ -29,5 +29,5 @@
|
||||
name: "{{ item }}"
|
||||
state: "started"
|
||||
pattern: "{{ item }}"
|
||||
with_items: swift_proxy_program_names
|
||||
with_items: "{{ swift_proxy_program_names }}"
|
||||
when: inventory_hostname in groups['swift_proxy']
|
||||
|
Loading…
Reference in New Issue
Block a user