mirror of https://github.com/ceph/ceph-ansible.git
nfs: do not create the nfs user if already present
Check if the user exists and skip its creation if true. Closes: https://github.com/ceph/ceph-ansible/issues/3254 Signed-off-by: Sébastien Han <seb@redhat.com>pull/3270/head
parent
fc20973c2b
commit
5ab90b358c
|
@ -5,7 +5,17 @@
|
|||
when:
|
||||
- containerized_deployment
|
||||
|
||||
- name: create rgw nfs user
|
||||
- name: check if "{{ ceph_nfs_rgw_user }}" exists
|
||||
command: "{{ docker_exec_cmd_nfs | default('') }} radosgw-admin --cluster {{ cluster }} user info --uid={{ ceph_nfs_rgw_user }}"
|
||||
run_once: true
|
||||
register: rgwuser_exists
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||
when:
|
||||
- nfs_obj_gw
|
||||
|
||||
- name: create rgw nfs user "{{ ceph_nfs_rgw_user }}"
|
||||
command: "{{ docker_exec_cmd_nfs | default('') }} radosgw-admin --cluster {{ cluster }} user create --uid={{ ceph_nfs_rgw_user }} --display-name='RGW NFS User'"
|
||||
run_once: true
|
||||
register: rgwuser
|
||||
|
@ -13,10 +23,11 @@
|
|||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||
when:
|
||||
- nfs_obj_gw
|
||||
- rgwuser_exists.get('rc', 1) != 0
|
||||
|
||||
- name: set_fact ceph_nfs_rgw_access_key
|
||||
set_fact:
|
||||
ceph_nfs_rgw_access_key: "{{ (rgwuser.stdout | from_json)['keys'][0]['access_key'] }}"
|
||||
ceph_nfs_rgw_access_key: "{{ (rgwuser.stdout | from_json)['keys'][0]['access_key'] if rgwuser_exists.get('rc', 1) != 0 else (rgwuser_exists.stdout | from_json)['keys'][0]['access_key'] }}"
|
||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||
when:
|
||||
- nfs_obj_gw
|
||||
|
@ -24,7 +35,7 @@
|
|||
|
||||
- name: set_fact ceph_nfs_rgw_secret_key
|
||||
set_fact:
|
||||
ceph_nfs_rgw_secret_key: "{{(rgwuser.stdout | from_json)['keys'][0]['secret_key']}}"
|
||||
ceph_nfs_rgw_secret_key: "{{ (rgwuser.stdout | from_json)['keys'][0]['secret_key'] if rgwuser_exists.get('rc', 1) != 0 else (rgwuser_exists.stdout | from_json)['keys'][0]['secret_key'] }}"
|
||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||
when:
|
||||
- nfs_obj_gw
|
||||
|
|
Loading…
Reference in New Issue