Cleanup syntax issues for Ansible 2 compatibility
This patch fixes a few syntax issues required for Ansible 2 compatibility that Ansible 1.x was more lenient with. When a 'when' clause is combined with a 'with_*' statement, the clause is processed separately for each item. Tasks with 'when' clauses which depended on an item variable being defined have either applied a default empty value to the item or a new task individual task has been created for each item in the loop. Tasks within the os-cinder-install playboook have been updated to loop through cinder_backends as a hash. Change-Id: I9b53eb5dd709a6bed1797961015aa3dd328340f3
This commit is contained in:
parent
533a0a86cc
commit
0e2425621d
@ -31,8 +31,8 @@
|
|||||||
owner: "{{ swift_system_user_name }}"
|
owner: "{{ swift_system_user_name }}"
|
||||||
group: "{{ swift_system_group_name }}"
|
group: "{{ swift_system_group_name }}"
|
||||||
with_items:
|
with_items:
|
||||||
- { item: "{{ swift.account }}", port: "{{ swift_account_port }}", type: "account" }
|
- { item: "{{ swift.account | default({}) }}", port: "{{ swift_account_port }}", type: "account" }
|
||||||
- { item: "{{ swift.container }}", port: "{{ swift_container_port}}", type: "container" }
|
- { item: "{{ swift.container | default({}) }}", port: "{{ swift_container_port}}", type: "container" }
|
||||||
tags:
|
tags:
|
||||||
- swift-rings
|
- swift-rings
|
||||||
- swift-rings-contents
|
- swift-rings-contents
|
||||||
@ -68,8 +68,7 @@
|
|||||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/{{ item[0] }}.contents -r {{ item[1] }}"
|
command: "/usr/bin/python /etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/{{ item[0] }}.contents -r {{ item[1] }}"
|
||||||
with_nested:
|
with_nested:
|
||||||
- [ 'account', 'container' ]
|
- [ 'account', 'container' ]
|
||||||
- swift_managed_regions
|
- swift_managed_regions | default([])
|
||||||
when: swift_managed_regions is defined
|
|
||||||
sudo: yes
|
sudo: yes
|
||||||
sudo_user: "{{ swift_system_user_name }}"
|
sudo_user: "{{ swift_system_user_name }}"
|
||||||
args:
|
args:
|
||||||
@ -95,8 +94,7 @@
|
|||||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents -r {{ item[1] }}"
|
command: "/usr/bin/python /etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents -r {{ item[1] }}"
|
||||||
with_nested:
|
with_nested:
|
||||||
- "{{ swift.storage_policies }}"
|
- "{{ swift.storage_policies }}"
|
||||||
- swift_managed_regions
|
- swift_managed_regions | default([])
|
||||||
when: swift_managed_regions is defined
|
|
||||||
sudo: yes
|
sudo: yes
|
||||||
sudo_user: "{{ swift_system_user_name }}"
|
sudo_user: "{{ swift_system_user_name }}"
|
||||||
args:
|
args:
|
||||||
|
@ -61,8 +61,7 @@
|
|||||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/{{ item[0] }}.contents -r {{ item[1] }}"
|
command: "/usr/bin/python /etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/{{ item[0] }}.contents -r {{ item[1] }}"
|
||||||
with_nested:
|
with_nested:
|
||||||
- [ 'account', 'container' ]
|
- [ 'account', 'container' ]
|
||||||
- swift_managed_regions
|
- swift_managed_regions | default([])
|
||||||
when: swift_managed_regions is defined
|
|
||||||
sudo: yes
|
sudo: yes
|
||||||
sudo_user: "{{ swift_system_user_name }}"
|
sudo_user: "{{ swift_system_user_name }}"
|
||||||
args:
|
args:
|
||||||
@ -88,8 +87,7 @@
|
|||||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents -r {{ item[1] }}"
|
command: "/usr/bin/python /etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents -r {{ item[1] }}"
|
||||||
with_nested:
|
with_nested:
|
||||||
- "{{ swift.storage_policies }}"
|
- "{{ swift.storage_policies }}"
|
||||||
- swift_managed_regions
|
- swift_managed_regions | default([])
|
||||||
when: swift_managed_regions is defined
|
|
||||||
sudo: yes
|
sudo: yes
|
||||||
sudo_user: "{{ swift_system_user_name }}"
|
sudo_user: "{{ swift_system_user_name }}"
|
||||||
args:
|
args:
|
||||||
|
@ -18,7 +18,10 @@
|
|||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: "started"
|
state: "started"
|
||||||
pattern: "{{ item }}"
|
pattern: "{{ item }}"
|
||||||
with_items: swift_account_program_names + swift_container_program_names + swift_object_program_names
|
with_items:
|
||||||
|
- "{{ swift_account_program_names }}"
|
||||||
|
- "{{ swift_container_program_names }}"
|
||||||
|
- "{{ swift_object_program_names }}"
|
||||||
when: inventory_hostname in groups['swift_hosts']
|
when: inventory_hostname in groups['swift_hosts']
|
||||||
|
|
||||||
- name: "Ensure services are started"
|
- name: "Ensure services are started"
|
||||||
|
Loading…
Reference in New Issue
Block a user