don't access other node's docker_exec_cmd variable

Except for some corner case, it's not correct to access some other
node's copy of variable docker_exec_cmd. Therefore replace
"hostvars[groups[mon_group_name][0]]['docker_exec_cmd']" by
"docker_exec_cmd".

Signed-off-by: Rishabh Dave <ridave@redhat.com>
pull/3940/head
Rishabh Dave 2019-04-28 22:12:45 +05:30 committed by Guillaume Abrioux
parent f201222447
commit 89748d579a
3 changed files with 10 additions and 11 deletions

View File

@ -22,7 +22,7 @@
block: block:
- name: create filesystem pools - name: create filesystem pools
command: > command: >
{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} {{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }}
osd pool create {{ item.name }} osd pool create {{ item.name }}
{{ item.pg_num | default(item.pgs) | default(osd_pool_default_pg_num) }} {{ item.pg_num | default(item.pgs) | default(osd_pool_default_pg_num) }}
{{ item.pgp_num | default(item.pgs) | default(item.pg_num) | default(osd_pool_default_pg_num) }} {{ item.pgp_num | default(item.pgs) | default(item.pg_num) | default(osd_pool_default_pg_num) }}

View File

@ -1,8 +1,7 @@
--- ---
- name: check if monitor initial keyring already exists - name: check if monitor initial keyring already exists
command: > command: >
{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} {{ docker_exec_cmd | default('') }} ceph --cluster ceph --name mon. -k
ceph --cluster ceph --name mon. -k
/var/lib/ceph/mon/{{ cluster }}-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}/keyring /var/lib/ceph/mon/{{ cluster }}-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}/keyring
auth get-key mon. auth get-key mon.
register: initial_mon_key register: initial_mon_key

View File

@ -1,9 +1,9 @@
--- ---
- name: wait for all osd to be up - name: wait for all osd to be up
shell: > shell: >
test "$({{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_osds"])')" -gt 0 && test "$({{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_osds"])')" -gt 0 &&
test "$({{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_osds"])')" = test "$({{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_osds"])')" =
"$({{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_up_osds"])')" "$({{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["osdmap"]["osdmap"]["num_up_osds"])')"
register: wait_for_all_osds_up register: wait_for_all_osds_up
retries: "{{ nb_retry_wait_osd_up }}" retries: "{{ nb_retry_wait_osd_up }}"
delay: "{{ delay_wait_osd_up }}" delay: "{{ delay_wait_osd_up }}"
@ -15,7 +15,7 @@
block: block:
- name: list existing pool(s) - name: list existing pool(s)
command: > command: >
{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} {{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }}
osd pool get {{ item.name }} size osd pool get {{ item.name }} size
with_items: "{{ openstack_pools | unique }}" with_items: "{{ openstack_pools | unique }}"
register: created_pools register: created_pools
@ -24,7 +24,7 @@
- name: create openstack pool(s) - name: create openstack pool(s)
command: > command: >
{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} {{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }}
osd pool create {{ item.0.name }} osd pool create {{ item.0.name }}
{{ item.0.pg_num | default(osd_pool_default_pg_num) }} {{ item.0.pg_num | default(osd_pool_default_pg_num) }}
{{ item.0.pgp_num | default(item.0.pg_num) | default(osd_pool_default_pg_num) }} {{ item.0.pgp_num | default(item.0.pg_num) | default(osd_pool_default_pg_num) }}
@ -43,7 +43,7 @@
- name: customize pool size - name: customize pool size
command: > command: >
{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} {{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }}
osd pool set {{ item.name }} size {{ item.size | default(osd_pool_default_size) }} osd pool set {{ item.name }} size {{ item.size | default(osd_pool_default_size) }}
with_items: "{{ openstack_pools | unique }}" with_items: "{{ openstack_pools | unique }}"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
@ -52,7 +52,7 @@
- name: customize pool min_size - name: customize pool min_size
command: > command: >
{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} {{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }}
osd pool set {{ item.name }} min_size {{ item.min_size | default(osd_pool_default_min_size) }} osd pool set {{ item.name }} min_size {{ item.min_size | default(osd_pool_default_min_size) }}
with_items: "{{ openstack_pools | unique }}" with_items: "{{ openstack_pools | unique }}"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
@ -60,7 +60,7 @@
when: (item.min_size | default(osd_pool_default_min_size))|int > ceph_osd_pool_default_min_size when: (item.min_size | default(osd_pool_default_min_size))|int > ceph_osd_pool_default_min_size
- name: assign application to pool(s) - name: assign application to pool(s)
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool application enable {{ item.name }} {{ item.application }}" command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool application enable {{ item.name }} {{ item.application }}"
with_items: "{{ openstack_pools | unique }}" with_items: "{{ openstack_pools | unique }}"
changed_when: false changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"