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

118 lines
3.4 KiB
YAML
Raw Normal View History

---
- set_fact:
mds_name: "{{ ansible_hostname }}"
when: not mds_use_fqdn
- set_fact:
mds_name: "{{ ansible_fqdn }}"
when: mds_use_fqdn
- 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
2015-10-19 10:56:02 +08:00
copy:
src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}"
dest: "{{ item.name }}"
owner: "{{ key_owner }}"
group: "{{ key_group }}"
mode: "{{ key_mode }}"
with_items:
- { name: "/var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring", copy_key: true }
- { name: "/etc/ceph/{{ cluster }}.client.admin.keyring", copy_key: "{{ copy_admin_key }}" }
when:
cephx and
item.copy_key|bool
- name: create mds directory
file:
path: /var/lib/ceph/mds/{{ cluster }}-{{ mds_name }}
state: directory
owner: "{{ dir_owner }}"
group: "{{ dir_group }}"
mode: "{{ dir_mode }}"
- name: create mds keyring
command: ceph --cluster {{ cluster }} --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring auth get-or-create mds.{{ mds_name }} osd 'allow rwx' mds 'allow' mon 'allow profile mds' -o /var/lib/ceph/mds/{{ cluster }}-{{ mds_name }}/keyring
2015-10-19 10:56:02 +08:00
args:
creates: /var/lib/ceph/mds/{{ cluster }}-{{ mds_name }}/keyring
changed_when: false
when: cephx
- name: set mds key permissions
file:
path: /var/lib/ceph/mds/{{ cluster }}-{{ mds_name }}/keyring
mode: "{{ key_mode }}"
owner: "{{ key_owner }}"
group: "{{ key_group }}"
when: cephx
- name: activate metadata server with upstart
2015-10-19 10:56:02 +08:00
file:
path: /var/lib/ceph/mds/{{ cluster }}-{{ mds_name }}/{{ item }}
2015-10-19 10:56:02 +08:00
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
2015-10-19 10:56:02 +08:00
file:
path: /var/lib/ceph/mds/{{ cluster }}-{{ mds_name }}/{{ item }}
2015-10-19 10:56:02 +08:00
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@{{ mds_name }}.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)
command: initctl emit ceph-mds cluster={{ cluster }} id={{ mds_name }}
changed_when: false
failed_when: false
when: ansible_distribution == "Ubuntu"
- name: start and add that the metadata service to the init sequence (before infernalis)
2015-10-19 10:56:02 +08:00
service:
name: ceph
state: started
enabled: yes
args: mds.{{ mds_name }}
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@{{ mds_name }}
state: started
enabled: yes
changed_when: false
when:
ansible_distribution != "Ubuntu" and
is_ceph_infernalis