Skip to content
Snippets Groups Projects
start_monitor.yml 1.94 KiB
Newer Older
- name: activate monitor with upstart
  file:
    path: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/{{ item }}
    state: touch
    owner: "{{ activate_file_owner }}"
    group: "{{ activate_file_group }}"
    mode: "{{ activate_file_mode }}"
  changed_when: false
  with_items:
    - done
    - upstart
  when: ansible_distribution == "Ubuntu"
leseb's avatar
leseb committed
- name: start and add that the monitor service to the init sequence (ubuntu)
  command: initctl emit ceph-mon cluster={{ cluster }} id={{ monitor_name }}
  changed_when: false
  failed_when: false
  when: ansible_distribution == "Ubuntu"

# NOTE (leseb): somehow the service ansible module is messing things up
# as a safety measure we run the raw command
Sébastien Han's avatar
Sébastien Han committed
- name: start and add that the monitor service to the init sequence
  command: service ceph start mon
leseb's avatar
leseb committed
  changed_when: false
  when:
    ansible_distribution != "Ubuntu" and
    not is_ceph_infernalis
- name: enable systemd unit file for mon instance (for or after infernalis)
  file:
    src: /usr/lib/systemd/system/ceph-mon@.service
Sébastien Han's avatar
Sébastien Han committed
    dest: /etc/systemd/system/multi-user.target.wants/ceph-mon@{{ monitor_name }}.service
    state: link
  changed_when: false
  failed_when: false
  when:
    ansible_distribution != "Ubuntu" and
    is_ceph_infernalis

- name: start and add that the monitor service to the init sequence (for or after infernalis)
  service:
Sébastien Han's avatar
Sébastien Han committed
      name: ceph-mon@{{ monitor_name }}
      state: started
      enabled: yes
  changed_when: false
  when:
    ansible_distribution != "Ubuntu" and
    is_ceph_infernalis
- name: collect admin and bootstrap keys
  command: ceph-create-keys --cluster {{ cluster }} --id {{ monitor_name }}
  changed_when: false
  failed_when:  false
leseb's avatar
leseb committed
- name: get ceph monitor version
  shell: ceph --cluster {{ cluster }} daemon mon."{{ monitor_name }}" version | cut -d '"' -f 4 | cut -f 1,2 -d '.'
leseb's avatar
leseb committed
  changed_when: false
  failed_when: "'No such file or directory' in ceph_version.stderr"
  register: ceph_version