Refactor Swift ring build & check tasks
We use duplicate tasks to handle a case where we specify swift_managed_regions, we could handle this with an if statement that will only add the '-r' flag when the variable is specified. This PR removes the 2 duplicate tasks in both the build and distribution_check tasks. Change-Id: Icba70faf90c5e54499c67bac382a8bd507143ee8
This commit is contained in:
parent
e4b4d621b2
commit
eb04bf154d
@ -51,24 +51,10 @@
|
||||
- swift-rings-contents
|
||||
|
||||
- name: "build rings for account/container from contents files"
|
||||
command: "/etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/{{ item }}.contents"
|
||||
with_items:
|
||||
- account
|
||||
- container
|
||||
when: swift_managed_regions is not defined
|
||||
become: yes
|
||||
become_user: "{{ swift_system_user_name }}"
|
||||
args:
|
||||
chdir: /etc/swift/ring_build_files/
|
||||
tags:
|
||||
- swift-rings
|
||||
- swift-rings-build
|
||||
|
||||
- name: "build rings for account/container from contents files"
|
||||
command: "/etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/{{ item[0] }}.contents -r {{ item[1] }}"
|
||||
command: "/etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/{{ item[0] }}.contents{% if item[1] %} -r {{ item[1] }} {% endif %}"
|
||||
with_nested:
|
||||
- [ 'account', 'container' ]
|
||||
- swift_managed_regions | default([])
|
||||
- swift_managed_regions | default([None])
|
||||
become: yes
|
||||
become_user: "{{ swift_system_user_name }}"
|
||||
args:
|
||||
@ -78,23 +64,10 @@
|
||||
- swift-rings-build
|
||||
|
||||
- name: "build rings for storage policies from contents files"
|
||||
command: "/etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/object-{{ item.policy.index }}.contents"
|
||||
with_items:
|
||||
- "{{ swift.storage_policies }}"
|
||||
when: swift_managed_regions is not defined
|
||||
become: yes
|
||||
become_user: "{{ swift_system_user_name }}"
|
||||
args:
|
||||
chdir: /etc/swift/ring_build_files/
|
||||
tags:
|
||||
- swift-rings
|
||||
- swift-rings-build
|
||||
|
||||
- name: "build rings for storage policies from contents files"
|
||||
command: "/etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents -r {{ item[1] }}"
|
||||
command: "/etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents{% if item[1] %} -r {{ item[1] }} {% endif %}"
|
||||
with_nested:
|
||||
- "{{ swift.storage_policies }}"
|
||||
- swift_managed_regions | default([])
|
||||
- swift_managed_regions | default([None])
|
||||
become: yes
|
||||
become_user: "{{ swift_system_user_name }}"
|
||||
args:
|
||||
|
@ -44,24 +44,10 @@
|
||||
- swift-rings-scripts
|
||||
|
||||
- name: "Ensure contents file matches ring after ring sync for account/container"
|
||||
command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/{{ item }}.contents"
|
||||
with_items:
|
||||
- account
|
||||
- container
|
||||
when: swift_managed_regions is not defined
|
||||
become: yes
|
||||
become_user: "{{ swift_system_user_name }}"
|
||||
args:
|
||||
chdir: /etc/swift/ring_build_files/
|
||||
tags:
|
||||
- swift-rings
|
||||
- swift-rings-check
|
||||
|
||||
- name: "Ensure contents file matches ring after ring sync for account/container"
|
||||
command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/{{ item[0] }}.contents -r {{ item[1] }}"
|
||||
command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/{{ item[0] }}.contents{% if item[1] %} -r {{ item[1] }} {% endif %}"
|
||||
with_nested:
|
||||
- [ 'account', 'container' ]
|
||||
- swift_managed_regions | default([])
|
||||
- swift_managed_regions | default([None])
|
||||
become: yes
|
||||
become_user: "{{ swift_system_user_name }}"
|
||||
args:
|
||||
@ -71,23 +57,10 @@
|
||||
- swift-rings-check
|
||||
|
||||
- name: "Ensure contents file matches ring after ring sync for storage policies"
|
||||
command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/object-{{ item.policy.index }}.contents"
|
||||
with_items:
|
||||
- "{{ swift.storage_policies }}"
|
||||
when: swift_managed_regions is not defined
|
||||
become: yes
|
||||
become_user: "{{ swift_system_user_name }}"
|
||||
args:
|
||||
chdir: /etc/swift/ring_build_files/
|
||||
tags:
|
||||
- swift-rings
|
||||
- swift-rings-check
|
||||
|
||||
- name: "Ensure contents file matches ring after ring sync for storage policies"
|
||||
command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents -r {{ item[1] }}"
|
||||
command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents{% if item[1] %} -r {{ item[1] }} {% endif %}"
|
||||
with_nested:
|
||||
- "{{ swift.storage_policies }}"
|
||||
- swift_managed_regions | default([])
|
||||
- swift_managed_regions | default([None])
|
||||
become: yes
|
||||
become_user: "{{ swift_system_user_name }}"
|
||||
args:
|
||||
|
Loading…
x
Reference in New Issue
Block a user