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

107 lines
3.1 KiB
YAML

---
- name: create bootstrap-mds directory
file:
path: /var/lib/ceph/bootstrap-mds/
state: directory
owner: "{{ dir_owner }}"
group: "{{ dir_group }}"
mode: "{{ dir_mode }}"
- name: copy mds bootstrap key
copy:
src: "{{ fetch_directory }}/{{ fsid }}/var/lib/ceph/bootstrap-mds/ceph.keyring"
dest: /var/lib/ceph/bootstrap-mds/ceph.keyring
owner: "{{ key_owner }}"
group: "{{ key_group }}"
mode: "{{ key_mode }}"
- name: create mds directory
file:
path: /var/lib/ceph/mds/ceph-{{ ansible_hostname }}
state: directory
owner: "{{ dir_owner }}"
group: "{{ dir_group }}"
mode: "{{ dir_mode }}"
- name: create mds keyring
command: ceph --cluster ceph --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/ceph.keyring auth get-or-create mds.{{ ansible_hostname }} osd 'allow rwx' mds 'allow' mon 'allow profile mds' -o /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/keyring
args:
creates: /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/keyring
changed_when: false
when: cephx
- name: set mds key permissions
file:
path: /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/keyring
mode: "{{ key_mode }}"
owner: "{{ key_owner }}"
group: "{{ key_group }}"
when: cephx
- name: activate metadata server with upstart
file:
path: /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/{{ item }}
state: touch
owner: "{{ activate_file_owner }}"
group: "{{ activate_file_group }}"
mode: "{{ activate_file_mode }}"
with_items:
- done
- upstart
changed_when: false
when: ansible_distribution == "Ubuntu"
- name: activate metadata server with sysvinit
file:
path: /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/{{ item }}
state: touch
owner: "{{ activate_file_owner }}"
group: "{{ activate_file_group }}"
mode: "{{ activate_file_mode }}"
with_items:
- done
- sysvinit
changed_when: false
when: ansible_distribution != "Ubuntu"
- name: enable systemd unit file for mds instance (for or after infernalis)
file:
src: /usr/lib/systemd/system/ceph-mds@.service
dest: /etc/systemd/system/multi-user.target.wants/ceph-mds@{{ ansible_hostname }}.service
state: link
changed_when: false
failed_when: false
when:
ansible_distribution != "Ubuntu" and
is_ceph_infernalis
- name: start and add that the metadata service to the init sequence (ubuntu)
service:
name: ceph-mds
state: started
enabled: yes
args: "id={{ ansible_hostname }}"
changed_when: false
when: ansible_distribution == "Ubuntu"
- name: start and add that the metadata service to the init sequence (before infernalis)
service:
name: ceph
state: started
enabled: yes
args: mds.{{ ansible_hostname }}
changed_when: false
when:
ansible_distribution != "Ubuntu" and
not is_ceph_infernalis
- name: start and add that the metadata service to the init sequence (for or after infernalis)
service:
name: ceph-mds@{{ ansible_hostname }}
state: started
enabled: yes
changed_when: false
when:
ansible_distribution != "Ubuntu" and
is_ceph_infernalis