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

72 lines
2.2 KiB
YAML

---
- name: populate kv_store with default ceph.conf
docker:
name: populate-kv-store
image: "{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}:{{ ceph_mon_docker_image_tag }}"
command: populate_kvstore
net: host
env:
KV_TYPE: "{{kv_type}}"
KV_IP: "{{kv_endpoint}}"
KV_PORT: "{{kv_port}}"
run_once: true
when:
- inventory_hostname == groups.mons[0]
- mon_containerized_deployment_with_kv
- mon_containerized_default_ceph_conf_with_kv
- name: populate kv_store with custom ceph.conf
docker:
name: populate-kv-store
image: "{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}:{{ ceph_mon_docker_image_tag }}"
command: populate_kvstore
net: 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.mons[0]
- mon_containerized_deployment_with_kv
- not mon_containerized_default_ceph_conf_with_kv
- name: delete populate-kv-store docker
docker:
name: populate-kv-store
state: absent
image: "{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}:{{ ceph_mon_docker_image_tag }}"
when: mon_containerized_deployment_with_kv
# Use systemd to manage container on Atomic host and CoreOS
- 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"
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: enable systemd unit file for mon instance
shell: systemctl enable ceph-mon@{{ ansible_hostname }}.service
failed_when: false
changed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: reload systemd unit files
shell: systemctl daemon-reload
changed_when: false
failed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: systemd start mon container
service:
name: ceph-mon@{{ ansible_hostname }}
state: started
enabled: yes
changed_when: false