Use ceph fsid instead of slurp to get fsid

This commit is contained in:
Tunui Franken 2024-07-15 18:11:50 +02:00
parent 1fc8706f96
commit f9ae0c5c34
2 changed files with 14 additions and 13 deletions

View file

@ -39,10 +39,6 @@
src: /etc/ceph/ceph.conf
register: ceph_conf_slurp
- name: Get current fsid
ansible.builtin.set_fact:
fsid: "{{ ceph_conf_slurp.content | b64decode | regex_search('fsid = (.*)', '\\1') | first }}"
- name: Write ceph config to new mon
become: true
ansible.builtin.copy:
@ -52,6 +48,13 @@
group: root
mode: "644"
- name: Get current fsid
become: true
ansible.builtin.command:
cmd: ceph fsid
register: fsid
changed_when: false
- name: Slurp ceph.client.admin.keyring
delegate_to: ceph-mon-01
become: true
@ -72,7 +75,7 @@
delegate_to: ceph-mon-01
become: true
ansible.builtin.command:
cmd: "monmaptool --add {{ ansible_hostname }} {{ ip.mon }} --fsid {{ fsid }} /etc/ceph/monmap"
cmd: "monmaptool --add {{ ansible_hostname }} {{ ip.mon }} --fsid {{ fsid.stdout }} /etc/ceph/monmap"
register: result
changed_when: "'map already contains' not in result.stderr"
failed_when: "'map already contains' not in result.stderr and 'writing epoch' not in result.stdout"

View file

@ -23,14 +23,12 @@
group: root
mode: "644"
- name: Slurp ceph config to get fsid
ansible.builtin.slurp:
src: /etc/ceph/ceph.conf
register: ceph_conf_slurp
- name: Get current fsid
ansible.builtin.set_fact:
fsid: "{{ ceph_conf_slurp.content | b64decode | regex_search('fsid = (.*)', '\\1') | first }}"
become: true
ansible.builtin.command:
cmd: ceph fsid
register: fsid
changed_when: false
- name: Add mon_initial_members
become: true
@ -83,7 +81,7 @@
- name: Generate monitor map
become: true
ansible.builtin.command:
cmd: "monmaptool --create --add {{ ansible_hostname }} {{ ip.mon }} --fsid {{ fsid }} /etc/ceph/monmap"
cmd: "monmaptool --create --add {{ ansible_hostname }} {{ ip.mon }} --fsid {{ fsid.stdout }} /etc/ceph/monmap"
creates: /etc/ceph/monmap
- name: Create data directory on the monitor host