From 99c429930ed1e7b4defae884e97b84c099a923ba Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Tue, 12 Jan 2016 20:12:40 +0000 Subject: [PATCH 1/3] make systemd enable work for mon instance Signed-off-by: Huamin Chen --- roles/ceph-mon/tasks/start_monitor.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index f0710bd90..620fa276b 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -46,6 +46,13 @@ ansible_distribution != "Ubuntu" and not is_ceph_infernalis +- name: enable systemd unit file for mon instance (for or after infernalis) + command: "ln -s /usr/lib/systemd/system/ceph-mon@.service /etc/systemd/system/multi-user.target.wants/ceph-mon@{{ ansible_hostname }}.service" + changed_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: name: ceph-mon@{{ ansible_hostname }} From 519a9e91b1a08aae96e8eb8778470d8974f5d5b2 Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Tue, 12 Jan 2016 20:41:51 +0000 Subject: [PATCH 2/3] make systemd enable work for osd instance Signed-off-by: Huamin Chen --- roles/ceph-mon/tasks/start_monitor.yml | 3 ++- roles/ceph-osd/tasks/activate_osds.yml | 29 +++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index 620fa276b..9bda52c5e 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -47,8 +47,9 @@ not is_ceph_infernalis - name: enable systemd unit file for mon instance (for or after infernalis) - command: "ln -s /usr/lib/systemd/system/ceph-mon@.service /etc/systemd/system/multi-user.target.wants/ceph-mon@{{ ansible_hostname }}.service" + file: src=/usr/lib/systemd/system/ceph-mon@.service dest=/etc/systemd/system/multi-user.target.wants/ceph-mon@{{ ansible_hostname }}.service state=link changed_when: false + failed_when: false when: ansible_distribution != "Ubuntu" and is_ceph_infernalis diff --git a/roles/ceph-osd/tasks/activate_osds.yml b/roles/ceph-osd/tasks/activate_osds.yml index 21f2fc3e3..d93c0861e 100644 --- a/roles/ceph-osd/tasks/activate_osds.yml +++ b/roles/ceph-osd/tasks/activate_osds.yml @@ -32,11 +32,30 @@ ansible_distribution != "Ubuntu" and not is_ceph_infernalis -- name: start and add that the osd service(s) to the init sequence (for or after infernalis) - service: - name: ceph.target - state: started - enabled: yes +- name: get osd id (for or after infernalis) + shell: "ls /var/lib/ceph/osd/ |grep -oh '[0-9]*'" + changed_when: false + failed_when: false + register: osd_id + when: + ansible_distribution != "Ubuntu" and + is_ceph_infernalis + +- name: enable osd service instance(s) (for or after infernalis) + file: src=/usr/lib/systemd/system/ceph-osd@.service dest=/etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item }}.service state=link + with_items: osd_id.stdout_lines + failed_when: false + when: + ansible_distribution != "Ubuntu" and + is_ceph_infernalis + +- name: start and add that the osd service(s) to the init sequence (for or after infernalis) + service: + name: ceph-osd@{{ item }} + state: started + enabled: yes + with_items: osd_id.stdout_lines + changed_when: false when: ansible_distribution != "Ubuntu" and is_ceph_infernalis From 63bd78c12a7480ba04a4b0ee0109baa95165b05e Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Wed, 13 Jan 2016 14:13:30 +0000 Subject: [PATCH 3/3] review feedback: convert to yml format Signed-off-by: Huamin Chen --- roles/ceph-mon/tasks/start_monitor.yml | 5 ++++- roles/ceph-osd/tasks/activate_osds.yml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index 9bda52c5e..7de351f22 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -47,7 +47,10 @@ 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 dest=/etc/systemd/system/multi-user.target.wants/ceph-mon@{{ ansible_hostname }}.service state=link + file: + src: /usr/lib/systemd/system/ceph-mon@.service + dest: /etc/systemd/system/multi-user.target.wants/ceph-mon@{{ ansible_hostname }}.service + state: link changed_when: false failed_when: false when: diff --git a/roles/ceph-osd/tasks/activate_osds.yml b/roles/ceph-osd/tasks/activate_osds.yml index d93c0861e..0e5480c2f 100644 --- a/roles/ceph-osd/tasks/activate_osds.yml +++ b/roles/ceph-osd/tasks/activate_osds.yml @@ -42,7 +42,10 @@ is_ceph_infernalis - name: enable osd service instance(s) (for or after infernalis) - file: src=/usr/lib/systemd/system/ceph-osd@.service dest=/etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item }}.service state=link + file: + src: /usr/lib/systemd/system/ceph-osd@.service + dest: /etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item }}.service + state: link with_items: osd_id.stdout_lines failed_when: false when: