Dont run client dummy container on non-x86_64 hosts

The dummy client container currently wont work on non-x86_64 hosts.
This PR creates a filtered client group that contains only hosts
that are x86_64 - which can then be the group to run the
dummy container against.

This is for the specific case of a containerized_deployment where
there is a mixture of non-x86_64 hosts and x86_64 hosts. As such
the filtered group will contain all hosts when running with
containerized_deployment: false.

Currently ppc64le is not supported for Ceph server components.

Signed-off-by: Andy McCrae <andy.mccrae@gmail.com>
(cherry picked from commit 772e6b9be2)
pull/3090/head
Andy McCrae 2018-08-30 08:53:36 +01:00 committed by mergify[bot]
parent bc50f1038c
commit d0947f0fcf
1 changed files with 19 additions and 6 deletions

View File

@ -12,6 +12,19 @@
when: when:
- keys_tmp is defined - keys_tmp is defined
# dummy container setup is only supported on x86_64
# when running with containerized_deployment: true this task
# creates a group that contains only x86_64 hosts.
# when running with containerized_deployment: false this task
# will add all client hosts to the group (and not filter).
- name: create filtered clients group
add_host:
name: "{{ item }}"
groups: _filtered_clients
with_items: "{{ groups[client_group_name] }}"
when:
- (hostvars[item]['ansible_architecture'] == 'x86_64') or (not containerized_deployment)
- name: run a dummy container (sleep 300) from where we can create pool(s)/key(s) - name: run a dummy container (sleep 300) from where we can create pool(s)/key(s)
command: > command: >
docker run \ docker run \
@ -25,7 +38,7 @@
changed_when: false changed_when: false
when: when:
- containerized_deployment - containerized_deployment
- inventory_hostname == groups.get(client_group_name) | first - inventory_hostname == groups.get('_filtered_clients') | first
- name: set_fact delegated_node - name: set_fact delegated_node
set_fact: set_fact:
@ -57,7 +70,7 @@
when: when:
- cephx - cephx
- keys | length > 0 - keys | length > 0
- inventory_hostname == groups.get(client_group_name) | first - inventory_hostname == groups.get('_filtered_clients') | first
- name: slurp client cephx key(s) - name: slurp client cephx key(s)
slurp: slurp:
@ -69,7 +82,7 @@
when: when:
- cephx - cephx
- keys | length > 0 - keys | length > 0
- inventory_hostname == groups.get(client_group_name) | first - inventory_hostname == groups.get('_filtered_clients') | first
- name: list existing pool(s) - name: list existing pool(s)
command: > command: >
@ -81,7 +94,7 @@
delegate_to: "{{ delegated_node }}" delegate_to: "{{ delegated_node }}"
when: when:
- condition_copy_admin_key - condition_copy_admin_key
- inventory_hostname == groups.get(client_group_name, []) | first - inventory_hostname == groups.get('_filtered_clients', []) | first
- name: create ceph pool(s) - name: create ceph pool(s)
command: > command: >
@ -103,7 +116,7 @@
when: when:
- pools | length > 0 - pools | length > 0
- condition_copy_admin_key - condition_copy_admin_key
- inventory_hostname in groups.get(client_group_name) | first - inventory_hostname in groups.get('_filtered_clients') | first
- item.1.rc != 0 - item.1.rc != 0
- name: get client cephx keys - name: get client cephx keys
@ -114,6 +127,6 @@
owner: "{{ ceph_uid }}" owner: "{{ ceph_uid }}"
group: "{{ ceph_uid }}" group: "{{ ceph_uid }}"
with_items: with_items:
- "{{ hostvars[groups[client_group_name][0]]['slurp_client_keys']['results'] }}" - "{{ hostvars[groups['_filtered_clients'][0]]['slurp_client_keys']['results'] }}"
when: when:
- not item.get('skipped', False) - not item.get('skipped', False)