From b6b8437a7a28e4a0a2ef52d888b27fa7e5943a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 26 Mar 2015 15:43:54 +0100 Subject: [PATCH] Activate either sysvinit or upstart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Depending on the distro, init scripts will look for different files to be available on the ceph data dir. Fixing the upstart support here. Signed-off-by: Sébastien Han --- roles/ceph-mon/tasks/deploy_monitors.yml | 11 ------ roles/ceph-mon/tasks/main.yml | 3 ++ roles/ceph-mon/tasks/start_monitor.yml | 44 ++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 roles/ceph-mon/tasks/start_monitor.yml diff --git a/roles/ceph-mon/tasks/deploy_monitors.yml b/roles/ceph-mon/tasks/deploy_monitors.yml index 6f8fcfc07..06d954a57 100644 --- a/roles/ceph-mon/tasks/deploy_monitors.yml +++ b/roles/ceph-mon/tasks/deploy_monitors.yml @@ -23,14 +23,3 @@ command: > ceph-mon --mkfs -i {{ ansible_hostname }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }} creates=/var/lib/ceph/mon/ceph-{{ ansible_hostname }}/keyring - -- name: Start and add that the monitor service to the init sequence - service: > - name=ceph - state=started - enabled=yes - args=mon - -- name: Get Ceph monitor version - shell: ceph daemon mon."{{ ansible_hostname }}" version | cut -d '"' -f 4 | cut -f 1,2 -d '.' - register: ceph_version diff --git a/roles/ceph-mon/tasks/main.yml b/roles/ceph-mon/tasks/main.yml index 079768a5c..0f544efd1 100644 --- a/roles/ceph-mon/tasks/main.yml +++ b/roles/ceph-mon/tasks/main.yml @@ -2,6 +2,9 @@ - include: deploy_monitors.yml when: not ceph_containerized_deployment +- include: start_monitor.yml + when: not ceph_containerized_deployment + - include: ceph_keys.yml when: not ceph_containerized_deployment diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml new file mode 100644 index 000000000..94d94f764 --- /dev/null +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -0,0 +1,44 @@ +--- +- name: Activate monitor with upstart + file: > + path=/var/lib/ceph/mon/ceph-{{ ansible_hostname }}/{{ item }} + state=touch + owner=root + group=root + mode=0600 + with_items: + - done + - upstart + when: ansible_distribution == "Ubuntu" + +- name: Activate monitor with sysvinit + file: > + path=/var/lib/ceph/mon/ceph-{{ ansible_hostname }}/{{ item }} + state=touch + owner=root + group=root + mode=0600 + with_items: + - done + - sysvinit + when: ansible_distribution != "Ubuntu" + +- name: Start and add that the monitor service to the init sequence (Ubuntu) + service: > + name=ceph-mon + state=started + enabled=yes + args="id={{ ansible_hostname }}" + when: ansible_distribution == "Ubuntu" + +- name: Start and add that the monitor service to the init sequence + service: > + name=ceph + state=started + enabled=yes + args=mon + when: ansible_distribution != "Ubuntu" + +- name: Get Ceph monitor version + shell: ceph daemon mon."{{ ansible_hostname }}" version | cut -d '"' -f 4 | cut -f 1,2 -d '.' + register: ceph_version