Mark Goddard 41740f9752 Make kolla ansible user and group configurable
In some cases it is useful to use a user other than the default 'kolla'
to perform kolla ansible remote execution. Kolla is adding support for
this in the Rocky release, we should use it.

It is now possible to configure a different user via the
kolla_ansible_user and kolla_ansible_group variables.

Depends-On: https://review.openstack.org/581330

Change-Id: I280fb8f70eacd31fff0ae5671ddd6608cd02ae6e
Story: 2002914
Task: 22892
2018-07-10 14:12:39 +01:00

76 lines
2.3 KiB
YAML

---
- name: Ensure Swift ring build directory exists
file:
path: "{{ swift_ring_build_path }}"
state: directory
delegate_to: "{{ swift_ring_build_host }}"
run_once: True
- name: Ensure Swift rings are created
command: >
docker run
--rm
-v {{ swift_ring_build_path }}/:{{ kolla_config_path }}/config/swift/
{{ swift_image }}
swift-ring-builder {{ kolla_config_path }}/config/swift/{{ item }}.builder create
{{ swift_part_power }}
{{ swift_replication_count }}
{{ swift_min_part_hours }}
with_items: "{{ swift_service_names }}"
delegate_to: "{{ swift_ring_build_host }}"
run_once: True
- name: Ensure devices are added to Swift rings
command: >
docker run
--rm
-v {{ swift_ring_build_path }}/:{{ kolla_config_path }}/config/swift/
{{ swift_image }}
swift-ring-builder {{ kolla_config_path }}/config/swift/{{ item[0] }}.builder add
--region {{ swift_region }}
--zone {{ swift_zone }}
--ip {{ internal_net_name | net_ip }}
--port {{ swift_service_ports[item[0]] }}
--device {{ item[1] }}
--weight 100
with_nested:
- "{{ swift_service_names }}"
- "{{ swift_block_devices }}"
delegate_to: "{{ swift_ring_build_host }}"
- name: Ensure Swift rings are rebalanced
command: >
docker run
--rm
-v {{ swift_ring_build_path }}/:{{ kolla_config_path }}/config/swift/
{{ swift_image }}
swift-ring-builder {{ kolla_config_path }}/config/swift/{{ item }}.builder rebalance
with_items: "{{ swift_service_names }}"
delegate_to: "{{ swift_ring_build_host }}"
run_once: True
- name: Ensure Swift ring files are copied
local_action:
module: copy
src: "{{ swift_ring_build_path }}/{{ item[0] }}.{{ item[1] }}"
dest: "{{ kolla_config_path }}/config/swift/{{ item[0] }}.{{ item[1] }}"
remote_src: True
owner: "{{ ansible_user_uid }}"
group: "{{ ansible_user_gid }}"
mode: 0644
with_nested:
- "{{ swift_service_names }}"
- - ring.gz
- builder
delegate_to: "{{ swift_ring_build_host }}"
become: True
run_once: True
- name: Remove Swift ring build directory from build host
file:
path: "{{ swift_ring_build_path }}"
state: absent
delegate_to: "{{ swift_ring_build_host }}"
become: True
run_once: True