client: use dummy created container when there is no mon in inventory

the `docker_exec_cmd` fact set in client role when there is no monitor
in inventory is wrong, `ceph-client-{{ hostname }}` is never created so
it will fail anyway.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/2733/head
Guillaume Abrioux 2018-06-06 13:59:26 +02:00 committed by Sébastien Han
parent c94ada69e8
commit 7b156deb67
1 changed files with 4 additions and 8 deletions

View File

@ -26,12 +26,6 @@
run_once: true run_once: true
when: containerized_deployment when: containerized_deployment
- name: set docker_exec_client_cmd for containers
set_fact:
docker_exec_client_cmd: "docker exec ceph-create-keys"
run_once: true
when: containerized_deployment
- name: set_fact delegated_node - name: set_fact delegated_node
set_fact: set_fact:
delegated_node: "{{ groups[mon_group_name][0] if groups.get(mon_group_name, []) | length > 0 else inventory_hostname }}" delegated_node: "{{ groups[mon_group_name][0] if groups.get(mon_group_name, []) | length > 0 else inventory_hostname }}"
@ -42,7 +36,7 @@
- name: set_fact docker_exec_cmd - name: set_fact docker_exec_cmd
set_fact: set_fact:
docker_exec_cmd: "docker exec {% if groups.get(mon_group_name, []) | length > 0 -%} ceph-mon-{{ hostvars[delegated_node]['ansible_hostname'] }} {% else %} ceph-client-{{ hostvars[delegated_node]['ansible_hostname'] }} {% endif %}" docker_exec_cmd: "docker exec {% if groups.get(mon_group_name, []) | length > 0 -%} ceph-mon-{{ hostvars[delegated_node]['ansible_hostname'] }} {% else %} ceph-create-keys {% endif %}"
when: when:
- containerized_deployment - containerized_deployment
@ -52,13 +46,14 @@
name: "{{ item.name }}" name: "{{ item.name }}"
caps: "{{ item.caps }}" caps: "{{ item.caps }}"
secret: "{{ item.key | default('') }}" secret: "{{ item.key | default('') }}"
containerized: "{{ docker_exec_client_cmd | default('') }}" containerized: "{{ docker_exec_cmd | default('') }}"
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
dest: "{{ ceph_conf_key_directory }}" dest: "{{ ceph_conf_key_directory }}"
import_key: "{{ copy_admin_key }}" import_key: "{{ copy_admin_key }}"
mode: "{{ item.mode|default(omit) }}" mode: "{{ item.mode|default(omit) }}"
with_items: "{{ keys }}" with_items: "{{ keys }}"
run_once: true run_once: true
delegate_to: "{{ delegated_node }}"
when: when:
- cephx - cephx
- keys | length > 0 - keys | length > 0
@ -71,6 +66,7 @@
- "{{ keys }}" - "{{ keys }}"
register: slurp_client_keys register: slurp_client_keys
run_once: true run_once: true
delegate_to: "{{ delegated_node }}"
when: when:
- cephx - cephx
- keys | length > 0 - keys | length > 0