Skip to content

Commit 9934b37

Browse files
committed
remove osds from bootstrap, add osd spec feature
1 parent b9de8cb commit 9934b37

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ cephadm_public_network: "{{ storage_net_cidr }}"
2424
cephadm_cluster_network: "{{ storage_mgmt_net_cidr }}"
2525
# OSDs
2626
cephadm_osd_devices: []
27+
cephadm_osd_spec: []

tasks/bootstrap.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,5 @@
6464
become: true
6565
when: cephadm_install_ceph_cli
6666

67-
- name: Add OSDs
68-
command:
69-
cmd: "cephadm daemon add osd {{ ansible_hostname }}:{{ item }}"
70-
become: true
71-
when: cephadm_osd_devices | length > 0
72-
with_items: "{{ cephadm_osd_devices }}"
73-
7467
delegate_to: "{{ groups['mons'][0] }}"
7568
run_once: True

tasks/osds.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
---
22
- name: Add OSDs
3-
vars:
4-
ansible_host: "{{ hostvars[cephadm_host].ansible_host | default(cephadm_host) }}"
5-
command:
6-
cmd: "cephadm shell -- ceph orch daemon add osd {{ inventory_hostname }}:{{ item }}"
7-
become: true
8-
when: cephadm_osd_devices | length > 0
9-
with_items: "{{ cephadm_osd_devices }}"
10-
delegate_to: "{{ cephadm_host }}"
3+
block:
4+
- name: Add OSDs individually
5+
command:
6+
cmd: "cephadm daemon add osd {{ ansible_hostname }}:{{ item }}"
7+
become: true
8+
when: cephadm_osd_devices | length > 0
9+
with_items: "{{ cephadm_osd_devices }}"
10+
11+
- name: Template out osd_spec.yml
12+
copy:
13+
content: "{{ cephadm_osd_spec | to_nice_yaml(indent=2) }}"
14+
dest: "/var/run/ceph/{{ cephadm_fsid }}/osd_spec.yml"
15+
when: cephadm_osd_spec | length > 0
16+
become: true
17+
18+
- name: Apply OSDs spec
19+
command:
20+
cmd: >
21+
cephadm shell --
22+
ceph orch apply osd -i /var/run/ceph/osd_spec.yml
23+
when: cephadm_osd_spec | length > 0
24+
become: true
25+
26+
delegate_to: "{{ groups['mons'][0] }}"
27+
run_once: True

0 commit comments

Comments
 (0)