container: play docker-common only on first client node

This commit aims to set the default behavior to play
`ceph-docker-common` only on first node in clients group.

Currently, we play docker-common to pull container image so we can run
ceph commands in order to generate keys or create pools.
On a cluster with a large number of client nodes this can be time consuming
to proceed this way. An alternative would be to pull container image
only a first node and then copy keys on other nodes.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/2494/head
Guillaume Abrioux 2018-03-30 12:45:15 +02:00 committed by Sébastien Han
parent cf27c5e941
commit 9d3517c670
1 changed files with 4 additions and 6 deletions

View File

@ -50,18 +50,16 @@
roles:
- { role: ceph-defaults,
tags: [with_pkg, fetch_container_image],
when: "(containerized_deployment | bool) and not (is_atomic | bool)" }
when: "(((containerized_deployment | bool) and not (is_atomic | bool) and not (inventory_hostname in groups.get('clients', [False]))) or ((inventory_hostname == groups.get('clients', [False])|first) and (containerized_deployment | bool) and not (is_atomic | bool)))" }
- { role: ceph-docker-common,
tags: [with_pkg, fetch_container_image],
when: "(containerized_deployment | bool) and not (is_atomic | bool)" }
when: "(((containerized_deployment | bool) and not (is_atomic | bool) and not (inventory_hostname in groups.get('clients', [False]))) or ((inventory_hostname == groups.get('clients', [False])|first) and (containerized_deployment | bool) and not (is_atomic | bool)))" }
post_tasks:
- name: "pull {{ ceph_docker_image }} image"
command: "docker pull {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
changed_when: false
when:
- is_atomic
- (ceph_docker_dev_image is undefined or not ceph_docker_dev_image)
when: "((is_atomic and (ceph_docker_dev_image is undefined or not ceph_docker_dev_image) and not (inventory_hostname in groups.get('clients', [False]))) or (is_atomic and ((ceph_docker_dev_image is undefined) or not (ceph_docker_dev_image)) and (inventory_hostname == groups.get('clients', [False])|first)))"
- hosts: mons
tasks:
@ -281,7 +279,7 @@
start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
roles:
- { role: ceph-defaults, tags: ['ceph_update_config'] }
- ceph-docker-common
- { role: ceph-docker-common, when: "inventory_hostname == groups.get('clients', []) | first" }
- { role: ceph-config, tags: ['ceph_update_config'] }
- ceph-client
post_tasks: