2015-03-26 22:43:54 +08:00
|
|
|
---
|
2016-02-02 22:10:24 +08:00
|
|
|
- name: activate monitor with upstart
|
2015-11-17 23:10:02 +08:00
|
|
|
file:
|
2016-03-03 18:03:03 +08:00
|
|
|
path: /var/lib/ceph/mon/ceph-{{ monitor_name }}/{{ item }}
|
2015-11-17 23:10:02 +08:00
|
|
|
state: touch
|
2016-02-02 22:10:24 +08:00
|
|
|
owner: "{{ activate_file_owner }}"
|
|
|
|
group: "{{ activate_file_group }}"
|
|
|
|
mode: "{{ activate_file_mode }}"
|
2015-11-20 22:09:34 +08:00
|
|
|
changed_when: false
|
2015-11-17 23:10:02 +08:00
|
|
|
with_items:
|
|
|
|
- done
|
|
|
|
- upstart
|
2016-02-02 22:10:24 +08:00
|
|
|
when: ansible_distribution == "Ubuntu"
|
2015-03-26 22:43:54 +08:00
|
|
|
|
2015-07-24 02:01:43 +08:00
|
|
|
- name: start and add that the monitor service to the init sequence (ubuntu)
|
2015-10-17 07:55:31 +08:00
|
|
|
service:
|
|
|
|
name: ceph-mon
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
2016-03-03 18:03:03 +08:00
|
|
|
args: "id={{ monitor_name }}"
|
2015-03-26 22:43:54 +08:00
|
|
|
when: ansible_distribution == "Ubuntu"
|
|
|
|
|
2015-07-01 00:43:43 +08:00
|
|
|
# NOTE (leseb): somehow the service ansible module is messing things up
|
|
|
|
# as a safety measure we run the raw command
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: start and add that the monitor service to the init sequence
|
2015-07-01 00:43:43 +08:00
|
|
|
command: service ceph start mon
|
2015-07-04 02:18:41 +08:00
|
|
|
changed_when: false
|
2015-11-21 05:34:29 +08:00
|
|
|
when:
|
|
|
|
ansible_distribution != "Ubuntu" and
|
2015-11-20 22:09:34 +08:00
|
|
|
not is_ceph_infernalis
|
2015-11-21 05:34:29 +08:00
|
|
|
|
2016-01-13 04:12:40 +08:00
|
|
|
- name: enable systemd unit file for mon instance (for or after infernalis)
|
2016-01-13 22:13:30 +08:00
|
|
|
file:
|
|
|
|
src: /usr/lib/systemd/system/ceph-mon@.service
|
2016-03-03 18:03:03 +08:00
|
|
|
dest: /etc/systemd/system/multi-user.target.wants/ceph-mon@{{ monitor_name }}.service
|
2016-01-13 22:13:30 +08:00
|
|
|
state: link
|
2016-01-13 04:12:40 +08:00
|
|
|
changed_when: false
|
2016-01-13 04:41:51 +08:00
|
|
|
failed_when: false
|
2016-01-13 04:12:40 +08:00
|
|
|
when:
|
|
|
|
ansible_distribution != "Ubuntu" and
|
|
|
|
is_ceph_infernalis
|
|
|
|
|
2015-11-21 05:34:29 +08:00
|
|
|
- name: start and add that the monitor service to the init sequence (for or after infernalis)
|
|
|
|
service:
|
2016-03-03 18:03:03 +08:00
|
|
|
name: ceph-mon@{{ monitor_name }}
|
2015-11-21 05:34:29 +08:00
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
changed_when: false
|
|
|
|
when:
|
2015-12-10 04:52:23 +08:00
|
|
|
ansible_distribution != "Ubuntu" and
|
2015-11-20 22:09:34 +08:00
|
|
|
is_ceph_infernalis
|
2015-03-26 22:43:54 +08:00
|
|
|
|
2015-07-01 00:43:43 +08:00
|
|
|
- name: collect admin and bootstrap keys
|
2016-03-03 18:03:03 +08:00
|
|
|
command: ceph-create-keys --id {{ monitor_name }}
|
2015-07-01 00:43:43 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2016-02-25 21:57:50 +08:00
|
|
|
when: cephx
|
2015-07-01 00:43:43 +08:00
|
|
|
|
2015-07-24 02:01:43 +08:00
|
|
|
- name: get ceph monitor version
|
2016-03-03 18:03:03 +08:00
|
|
|
shell: ceph daemon mon."{{ monitor_name }}" version | cut -d '"' -f 4 | cut -f 1,2 -d '.'
|
2015-06-26 06:26:03 +08:00
|
|
|
changed_when: false
|
2015-07-24 18:36:45 +08:00
|
|
|
failed_when: "'No such file or directory' in ceph_version.stderr"
|
2015-03-26 22:43:54 +08:00
|
|
|
register: ceph_version
|