ceph-ansible/roles/ceph-mon/tasks/docker/start_docker_monitor.yml

60 lines
1.6 KiB
YAML
Raw Normal View History

---
- name: populate kv_store with default ceph.conf
docker_container:
name: populate-kv-store
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
command: populate_kvstore
network_mode: host
env:
KV_TYPE: "{{kv_type}}"
KV_IP: "{{kv_endpoint}}"
KV_PORT: "{{kv_port}}"
run_once: true
when:
- "{{ inventory_hostname == groups[mon_group_name][0] }}"
- containerized_deployment_with_kv
- mon_containerized_default_ceph_conf_with_kv
- name: populate kv_store with custom ceph.conf
docker_container:
name: populate-kv-store
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
command: populate_kvstore
network_mode: host
env:
KV_TYPE: "{{kv_type}}"
KV_IP: "{{kv_endpoint}}"
KV_PORT: "{{kv_port}}"
volumes:
- /etc/ceph/"{{ cluster }}".conf:/etc/ceph/ceph.defaults
run_once: true
when:
- "{{ inventory_hostname == groups[mon_group_name][0] }}"
- containerized_deployment_with_kv
- not mon_containerized_default_ceph_conf_with_kv
- name: delete populate-kv-store docker
docker_container:
name: populate-kv-store
state: absent
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
when: containerized_deployment_with_kv
- name: generate systemd unit file
become: true
template:
src: "{{ role_path }}/templates/ceph-mon.service.j2"
dest: /etc/systemd/system/ceph-mon@.service
owner: "root"
group: "root"
mode: "0644"
notify:
- restart ceph mons
- name: systemd start mon container
systemd:
name: ceph-mon@{{ ansible_hostname }}
state: started
enabled: yes
daemon_reload: yes