ceph-ansible/roles/ceph-mgr/tasks/pre_requisite.yml

76 lines
2.1 KiB
YAML

---
- name: install redhat ceph-mgr package
package:
name: ceph-mgr
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
when:
- ansible_os_family == 'RedHat'
- name: install ceph mgr for debian
apt:
name: ceph-mgr
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
default_release: "{{ ceph_stable_release_uca | default(omit) }}{{ ansible_distribution_release ~ '-backports' if ceph_origin == 'distro' and ceph_use_distro_backports else ''}}"
when:
- ansible_os_family == 'Debian'
- name: create mgr directory
file:
path: /var/lib/ceph/mgr/
state: directory
owner: "ceph"
group: "ceph"
mode: "0755"
- name: create mgr directory
file:
path: /var/lib/ceph/mgr/{{ cluster }}-{{ ansible_hostname }}
state: directory
owner: "ceph"
group: "ceph"
mode: "0755"
- name: copy mgr key
copy:
src: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.mgr.{{ ansible_hostname }}.keyring"
dest: "/var/lib/ceph/mgr/{{ cluster }}-{{ ansible_hostname }}/keyring"
owner: "ceph"
group: "ceph"
mode: "0600"
when:
- cephx
- name: set mgr key permissions
file:
path: /var/lib/ceph/mgr/{{ cluster }}-{{ ansible_hostname }}/keyring
owner: "ceph"
group: "ceph"
mode: "0600"
when:
- cephx
- name: ensure systemd service override directory exists
file:
state: directory
path: "/etc/systemd/system/ceph-mgr@.service.d/"
when:
- ceph_mgr_systemd_overrides is defined
- ansible_service_mgr == 'systemd'
- name: add ceph-mgr systemd service overrides
config_template:
src: "ceph-mgr.service.d-overrides.j2"
dest: "/etc/systemd/system/ceph-mgr@.service.d/ceph-mgr-systemd-overrides.conf"
config_overrides: "{{ ceph_mgr_systemd_overrides | default({}) }}"
config_type: "ini"
when:
- ceph_mgr_systemd_overrides is defined
- ansible_service_mgr == 'systemd'
- name: start and add that the mgr service to the init sequence
service:
name: "ceph-mgr@{{ ansible_hostname }}"
state: started
enabled: yes
changed_when: false