ceph-ansible/roles/ceph-mon/tasks/start_monitor.yml

39 lines
1.2 KiB
YAML

---
- name: ensure systemd service override directory exists
file:
state: directory
path: "/etc/systemd/system/ceph-mon@.service.d/"
when:
- not containerized_deployment
- ceph_mon_systemd_overrides is defined
- ansible_service_mgr == 'systemd'
- name: add ceph-mon systemd service overrides
config_template:
src: "ceph-mon.service.d-overrides.j2"
dest: "/etc/systemd/system/ceph-mon@.service.d/ceph-mon-systemd-overrides.conf"
config_overrides: "{{ ceph_mon_systemd_overrides | default({}) }}"
config_type: "ini"
when:
- not containerized_deployment
- ceph_mon_systemd_overrides is defined
- ansible_service_mgr == 'systemd'
- name: generate systemd unit file for mon container
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
when: containerized_deployment
- name: start the monitor service
systemd:
name: ceph-mon@{{ monitor_name if not containerized_deployment else ansible_hostname }}
state: started
enabled: yes
daemon_reload: yes