|
| 1 | +--- |
| 2 | +- name: Bootstrap cephadm |
| 3 | + block: |
| 4 | + - name: Template out cluster.yml |
| 5 | + template: |
| 6 | + src: "templates/cluster.yml.j2" |
| 7 | + dest: "/tmp/cephadm_cluster.yml" |
| 8 | + become: true |
| 9 | + run_once: True |
| 10 | + |
| 11 | + - name: Bootstrap cephadm |
| 12 | + vars: |
| 13 | + mon_ip: "{{ hostvars[inventory_hostname]['ansible_'~cephadm_public_interface].ipv4.address }}" |
| 14 | + monitoring_stack: "{{ '--skip-monitoring-stack' if not (cephadm_enable_monitoring | bool) else '' }}" |
| 15 | + dashboard: "{{ '--skip-dashboard' if not cephadm_enable_dashboard | bool else '' }}" |
| 16 | + firewalld: "{{ '--skip-firewalld' if not cephadm_enable_firewalld | bool else '' }}" |
| 17 | + command: |
| 18 | + cmd: > |
| 19 | + cephadm bootstrap |
| 20 | + {{ monitoring_stack }} |
| 21 | + {{ dashboard }} |
| 22 | + {{ firewalld }} |
| 23 | + --ssh-private-key={{ cephadm_ssh_private_key }} |
| 24 | + --ssh-public-key={{ cephadm_ssh_public_key }} |
| 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 | + --fsid={{ cephadm_fsid }} |
| 32 | + --mon-ip={{ mon_ip }} |
| 33 | + become: true |
| 34 | + when: not cephadm_check_ceph_conf.stat.exists |
| 35 | + |
| 36 | + - name: Set public network |
| 37 | + command: |
| 38 | + cmd: "cephadm shell -- ceph config set global public_network {{ cephadm_public_network }}" |
| 39 | + become: true |
| 40 | + |
| 41 | + - name: Set cluster network |
| 42 | + command: |
| 43 | + cmd: "cephadm shell -- ceph config set global cluster_network {{ cephadm_cluster_network }}" |
| 44 | + when: cephadm_cluster_network | length > 0 |
| 45 | + become: true |
| 46 | + |
| 47 | + - name: Template out cluster.yml |
| 48 | + template: |
| 49 | + src: "templates/cluster.yml.j2" |
| 50 | + dest: "/var/run/ceph/{{ cephadm_fsid }}/cephadm_cluster.yml" |
| 51 | + become: true |
| 52 | + run_once: True |
| 53 | + |
| 54 | + - name: Apply spec |
| 55 | + command: |
| 56 | + cmd: > |
| 57 | + cephadm shell -- |
| 58 | + ceph orch apply -i /var/run/ceph/cephadm_cluster.yml |
| 59 | + become: true |
| 60 | + |
| 61 | + - name: Install ceph cli on mon hosts |
| 62 | + command: |
| 63 | + cmd: "cephadm install ceph" |
| 64 | + become: true |
| 65 | + when: cephadm_install_ceph_cli |
| 66 | + |
| 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 | + |
| 74 | + delegate_to: "{{ groups['mons'][0] }}" |
| 75 | + run_once: True |
0 commit comments