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"
|
state: "restarted"
|
||||||
pattern: "{{ item }}"
|
pattern: "{{ item }}"
|
||||||
register: service_restart
|
register: service_restart
|
||||||
with_items: swift_account_program_names
|
with_items: "{{ swift_account_program_names }}"
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: Restart swift container services
|
- name: Restart swift container services
|
||||||
@ -28,7 +28,7 @@
|
|||||||
state: "restarted"
|
state: "restarted"
|
||||||
pattern: "{{ item }}"
|
pattern: "{{ item }}"
|
||||||
register: service_restart
|
register: service_restart
|
||||||
with_items: swift_container_program_names
|
with_items: "{{ swift_container_program_names }}"
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: Restart swift object services
|
- name: Restart swift object services
|
||||||
@ -37,7 +37,7 @@
|
|||||||
state: "restarted"
|
state: "restarted"
|
||||||
pattern: "{{ item }}"
|
pattern: "{{ item }}"
|
||||||
register: service_restart
|
register: service_restart
|
||||||
with_items: swift_object_program_names
|
with_items: "{{ swift_object_program_names }}"
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: Restart swift proxy services
|
- name: Restart swift proxy services
|
||||||
@ -46,7 +46,7 @@
|
|||||||
state: "restarted"
|
state: "restarted"
|
||||||
pattern: "{{ item }}"
|
pattern: "{{ item }}"
|
||||||
register: service_restart
|
register: service_restart
|
||||||
with_items: swift_proxy_program_names
|
with_items: "{{ swift_proxy_program_names }}"
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: Restart service
|
- name: Restart service
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
until: install_packages|success
|
until: install_packages|success
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 2
|
delay: 2
|
||||||
with_items: swift_apt_packages
|
with_items: "{{ swift_apt_packages }}"
|
||||||
tags:
|
tags:
|
||||||
- swift-install
|
- swift-install
|
||||||
- swift-apt-packages
|
- swift-apt-packages
|
@ -56,6 +56,15 @@
|
|||||||
tags:
|
tags:
|
||||||
- swift-setup
|
- 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
|
- include: swift_storage_hosts.yml
|
||||||
when:
|
when:
|
||||||
- inventory_hostname in groups['swift_hosts']
|
- inventory_hostname in groups['swift_hosts']
|
||||||
@ -69,7 +78,7 @@
|
|||||||
- inventory_hostname in groups['swift_proxy']
|
- inventory_hostname in groups['swift_proxy']
|
||||||
- swift_do_setup | bool
|
- swift_do_setup | bool
|
||||||
tags:
|
tags:
|
||||||
- swift-storage-hosts
|
- swift-proxy-hosts
|
||||||
- swift-setup
|
- swift-setup
|
||||||
|
|
||||||
- include: swift_service_setup.yml
|
- include: swift_service_setup.yml
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
until: install_packages|success
|
until: install_packages|success
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 2
|
delay: 2
|
||||||
with_items: swift_requires_pip_packages
|
with_items: "{{ swift_requires_pip_packages }}"
|
||||||
tags:
|
tags:
|
||||||
- swift-install
|
- swift-install
|
||||||
- swift-pip-packages
|
- swift-pip-packages
|
||||||
@ -178,7 +178,7 @@
|
|||||||
until: install_packages|success
|
until: install_packages|success
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 2
|
delay: 2
|
||||||
with_items: swift_pip_packages
|
with_items: "{{ swift_pip_packages }}"
|
||||||
when:
|
when:
|
||||||
- not swift_pypy_enabled | bool
|
- not swift_pypy_enabled | bool
|
||||||
- swift_get_venv | failed or swift_developer_mode | bool
|
- swift_get_venv | failed or swift_developer_mode | bool
|
||||||
|
@ -17,8 +17,10 @@
|
|||||||
authorized_key:
|
authorized_key:
|
||||||
user: "{{ swift_system_user_name }}"
|
user: "{{ swift_system_user_name }}"
|
||||||
key: "{{ hostvars[item]['swift_pubkey'] | b64decode }}"
|
key: "{{ hostvars[item]['swift_pubkey'] | b64decode }}"
|
||||||
with_items: groups['swift_all'] + groups['swift_remote_all']
|
with_items: "{{ groups['swift_all'] + groups['swift_remote_all'] }}"
|
||||||
when: hostvars[item]['swift_pubkey'] is defined
|
when:
|
||||||
|
- hostvars[item] is defined
|
||||||
|
- hostvars[item]['swift_pubkey'] is defined
|
||||||
tags:
|
tags:
|
||||||
- swift-key
|
- swift-key
|
||||||
- swift-key-create
|
- swift-key-create
|
||||||
|
@ -46,12 +46,10 @@
|
|||||||
|
|
||||||
- name: Copy swift config
|
- name: Copy swift config
|
||||||
template:
|
template:
|
||||||
src: "{{ item.src }}"
|
src: "swift-rsyslog.conf.j2"
|
||||||
dest: "{{ item.dest }}"
|
dest: "/etc/rsyslog.d/49-swift.conf"
|
||||||
owner: "{{ swift_system_user_name }}"
|
owner: "{{ swift_system_user_name }}"
|
||||||
group: "{{ swift_system_group_name }}"
|
group: "{{ swift_system_group_name }}"
|
||||||
with_items:
|
|
||||||
- { src: "swift-rsyslog.conf.j2", dest: "/etc/rsyslog.d/49-swift.conf" }
|
|
||||||
notify:
|
notify:
|
||||||
- Restart swift account services
|
- Restart swift account services
|
||||||
- Restart swift container services
|
- Restart swift container services
|
||||||
|
@ -35,9 +35,11 @@
|
|||||||
"The builder files on the remote host {{ item }}:{{ hostvars[item]['builder_md5sum'] }}
|
"The builder files on the remote host {{ item }}:{{ hostvars[item]['builder_md5sum'] }}
|
||||||
do not match {{ inventory_hostname }}:{{ md5sum.stdout }}
|
do not match {{ inventory_hostname }}:{{ md5sum.stdout }}
|
||||||
and are not empty on the remote host"
|
and are not empty on the remote host"
|
||||||
when: >
|
when:
|
||||||
("{{ hostvars[item]['builder_md5sum'] }}" != "{{ empty_md5sum.stdout }}") and
|
- hostvars[item] is defined
|
||||||
("{{ hostvars[item]['builder_md5sum'] }}" != "{{ md5sum.stdout }}")
|
- hostvars[item]['builder_md5sum'] is defined
|
||||||
with_items: groups['swift_all'] + groups['swift_remote_all']
|
- hostvars[item]['builder_md5sum'] != empty_md5sum.stdout
|
||||||
|
- hostvars[item]['builder_md5sum'] != md5sum.stdout
|
||||||
|
with_items: "{{ groups['swift_all'] + groups['swift_remote_all'] }}"
|
||||||
tags:
|
tags:
|
||||||
- swift-ring-check
|
- swift-ring-check
|
||||||
|
@ -26,12 +26,6 @@
|
|||||||
sysctl_set: yes
|
sysctl_set: yes
|
||||||
delegate_to: "{{ physical_host }}"
|
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"
|
- name: "Put /etc/rsyncd.conf in place"
|
||||||
template:
|
template:
|
||||||
src: "rsyncd.conf.j2"
|
src: "rsyncd.conf.j2"
|
||||||
@ -62,14 +56,4 @@
|
|||||||
owner: "{{ swift_system_user_name }}"
|
owner: "{{ swift_system_user_name }}"
|
||||||
group: "{{ swift_system_group_name }}"
|
group: "{{ swift_system_group_name }}"
|
||||||
state: "directory"
|
state: "directory"
|
||||||
with_items: swift_vars.drives
|
with_items: "{{ swift_vars.drives| default(swift.drives) | default([]) }}"
|
||||||
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
|
|
||||||
|
@ -29,5 +29,5 @@
|
|||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: "started"
|
state: "started"
|
||||||
pattern: "{{ item }}"
|
pattern: "{{ item }}"
|
||||||
with_items: swift_proxy_program_names
|
with_items: "{{ swift_proxy_program_names }}"
|
||||||
when: inventory_hostname in groups['swift_proxy']
|
when: inventory_hostname in groups['swift_proxy']
|
||||||
|
Loading…
Reference in New Issue
Block a user