|
1 | 1 | ---
|
2 | 2 | - name: Bootstrap cephadm
|
3 |
| - block: |
4 |
| - - name: Bootstrap cephadm |
5 |
| - vars: |
6 |
| - mon_ip: "{{ hostvars[inventory_hostname].ansible_facts[cephadm_public_interface].ipv4.address }}" |
7 |
| - monitoring_stack: "{{ '--skip-monitoring-stack' if not (cephadm_enable_monitoring | bool) else '' }}" |
8 |
| - dashboard: "{{ '--skip-dashboard' if not cephadm_enable_dashboard | bool else '' }}" |
9 |
| - firewalld: "{{ '--skip-firewalld' if not cephadm_enable_firewalld | bool else '' }}" |
10 |
| - command: |
11 |
| - cmd: > |
12 |
| - cephadm |
13 |
| - {% if cephadm_image | length > 0 %} |
14 |
| - --image={{ cephadm_image }} |
15 |
| - {% endif %} |
16 |
| - bootstrap |
17 |
| - {{ monitoring_stack }} |
18 |
| - {{ dashboard }} |
19 |
| - {{ firewalld }} |
20 |
| - --ssh-private-key={{ cephadm_ssh_private_key }} |
21 |
| - --ssh-public-key={{ cephadm_ssh_public_key }} |
22 |
| - {% if cephadm_ssh_user | length > 0 %} |
23 |
| - --ssh-user "{{ cephadm_ssh_user }}" |
24 |
| - {% endif %} |
25 |
| - {% if cephadm_registry_url | length > 0 %} |
26 |
| - --registry-url={{ cephadm_registry_url }} |
27 |
| - --registry-username={{ cephadm_registry_username }} |
28 |
| - --registry-password={{ cephadm_registry_password }} |
29 |
| - {% endif %} |
30 |
| - --skip-pull |
31 |
| - {% if cephadm_fsid | length > 0 %} |
32 |
| - --fsid={{ cephadm_fsid }} |
33 |
| - {% endif %} |
34 |
| - --mon-ip={{ mon_ip }} |
35 |
| - {{ cephadm_bootstrap_additional_parameters }} |
36 |
| - become: true |
37 |
| - when: not cephadm_check_ceph_conf.stat.exists |
| 3 | + vars: |
| 4 | + mon_ip: "{{ hostvars[inventory_hostname].ansible_facts[cephadm_public_interface].ipv4.address }}" |
| 5 | + monitoring_stack: "{{ '--skip-monitoring-stack' if not (cephadm_enable_monitoring | bool) else '' }}" |
| 6 | + dashboard: "{{ '--skip-dashboard' if not cephadm_enable_dashboard | bool else '' }}" |
| 7 | + firewalld: "{{ '--skip-firewalld' if not cephadm_enable_firewalld | bool else '' }}" |
| 8 | + command: |
| 9 | + cmd: > |
| 10 | + cephadm |
| 11 | + {% if cephadm_image | length > 0 %} |
| 12 | + --image={{ cephadm_image }} |
| 13 | + {% endif %} |
| 14 | + bootstrap |
| 15 | + {{ monitoring_stack }} |
| 16 | + {{ dashboard }} |
| 17 | + {{ firewalld }} |
| 18 | + --ssh-private-key={{ cephadm_ssh_private_key }} |
| 19 | + --ssh-public-key={{ cephadm_ssh_public_key }} |
| 20 | + {% if cephadm_ssh_user | length > 0 %} |
| 21 | + --ssh-user "{{ cephadm_ssh_user }}" |
| 22 | + {% endif %} |
| 23 | + {% if cephadm_registry_url | length > 0 %} |
| 24 | + --registry-url={{ cephadm_registry_url }} |
| 25 | + --registry-username={{ cephadm_registry_username }} |
| 26 | + --registry-password={{ cephadm_registry_password }} |
| 27 | + {% endif %} |
| 28 | + --skip-pull |
| 29 | + {% if cephadm_fsid | length > 0 %} |
| 30 | + --fsid={{ cephadm_fsid }} |
| 31 | + {% endif %} |
| 32 | + --mon-ip={{ mon_ip }} |
| 33 | + {{ cephadm_bootstrap_additional_parameters }} |
| 34 | + become: true |
| 35 | + when: not cephadm_check_ceph_conf.stat.exists |
38 | 36 |
|
39 |
| - - name: Set public network |
40 |
| - command: |
41 |
| - cmd: "cephadm shell -- ceph config set global public_network {{ cephadm_public_network }}" |
42 |
| - become: true |
| 37 | +- name: Set public network |
| 38 | + command: |
| 39 | + cmd: "cephadm shell -- ceph config set global public_network {{ cephadm_public_network }}" |
| 40 | + become: true |
43 | 41 |
|
44 |
| - - name: Set cluster network |
45 |
| - command: |
46 |
| - cmd: "cephadm shell -- ceph config set global cluster_network {{ cephadm_cluster_network }}" |
47 |
| - when: cephadm_cluster_network | length > 0 |
48 |
| - become: true |
| 42 | +- name: Set cluster network |
| 43 | + command: |
| 44 | + cmd: "cephadm shell -- ceph config set global cluster_network {{ cephadm_cluster_network }}" |
| 45 | + when: cephadm_cluster_network | length > 0 |
| 46 | + become: true |
49 | 47 |
|
50 |
| - - name: Get cluster fsid |
51 |
| - command: |
52 |
| - cmd: "cephadm shell -- ceph fsid" |
53 |
| - when: cephadm_fsid | length == 0 |
54 |
| - become: true |
55 |
| - register: cephadm_fsid_current |
| 48 | +- name: Get cluster fsid |
| 49 | + command: |
| 50 | + cmd: "cephadm shell -- ceph fsid" |
| 51 | + when: cephadm_fsid | length == 0 |
| 52 | + become: true |
| 53 | + register: cephadm_fsid_current |
56 | 54 |
|
57 |
| - - name: Template out cluster.yml |
58 |
| - vars: |
59 |
| - fsid: "{{ cephadm_fsid if cephadm_fsid | length > 0 else cephadm_fsid_current.stdout }}" |
60 |
| - template: |
61 |
| - src: "templates/cluster.yml.j2" |
62 |
| - dest: "/var/run/ceph/{{ fsid }}/cephadm_cluster.yml" |
63 |
| - owner: root |
64 |
| - group: root |
65 |
| - mode: 0644 |
66 |
| - become: true |
67 |
| - run_once: True |
68 |
| - |
69 |
| - - name: Apply spec |
70 |
| - command: |
71 |
| - cmd: > |
72 |
| - cephadm shell -- |
73 |
| - ceph orch apply -i /var/run/ceph/cephadm_cluster.yml |
74 |
| - become: true |
| 55 | +- name: Template out cluster.yml |
| 56 | + vars: |
| 57 | + fsid: "{{ cephadm_fsid if cephadm_fsid | length > 0 else cephadm_fsid_current.stdout }}" |
| 58 | + template: |
| 59 | + src: "templates/cluster.yml.j2" |
| 60 | + dest: "/var/run/ceph/{{ fsid }}/cephadm_cluster.yml" |
| 61 | + owner: root |
| 62 | + group: root |
| 63 | + mode: 0644 |
| 64 | + become: true |
| 65 | + run_once: True |
75 | 66 |
|
76 |
| - - name: Install ceph cli on mon hosts |
77 |
| - command: |
78 |
| - cmd: "cephadm install ceph" |
79 |
| - become: true |
80 |
| - when: cephadm_install_ceph_cli |
| 67 | +- name: Apply spec |
| 68 | + command: |
| 69 | + cmd: > |
| 70 | + cephadm shell -- |
| 71 | + ceph orch apply -i /var/run/ceph/cephadm_cluster.yml |
| 72 | + become: true |
81 | 73 |
|
82 |
| - delegate_to: "{{ groups['mons'][0] }}" |
83 |
| - run_once: True |
| 74 | +- name: Install ceph cli on mon hosts |
| 75 | + command: |
| 76 | + cmd: "cephadm install ceph" |
| 77 | + become: true |
| 78 | + when: cephadm_install_ceph_cli |
0 commit comments