From 28a5c296b3a26c217e0057c7cdd6451f642f495b Mon Sep 17 00:00:00 2001 From: georg Date: Mon, 21 Sep 2015 19:54:36 +0000 Subject: [PATCH 1/2] Jessie carbon-cache systemd support --- tasks/Debian.yml | 14 ++++++++++++++ templates/debian_carbon_service_systemd.j2 | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 templates/debian_carbon_service_systemd.j2 diff --git a/tasks/Debian.yml b/tasks/Debian.yml index 7768a84..a7bda41 100644 --- a/tasks/Debian.yml +++ b/tasks/Debian.yml @@ -19,11 +19,25 @@ - name: Install init.d script for carbon-cache template: src=debian_carbon_service.j2 dest=/etc/init.d/carbon-cache notify: restart carbon-cache + when: ansible_distribution_release == "wheesy" + +- name: Install systemd unit carbon-cache.service + template: src=debian_carbon_service_systemd.j2 dest=/etc/systemd/system/carbon-cache.service + when: ansible_distribution_release == "jessie" + register: ccunit - name: Check the install scripts perms file: path=/etc/init.d/{{ item }} mode=0755 owner=root group=root with_items: - carbon-cache + when: ansible_distribution_release == "wheesy" + +- name: Reload systemd if unit file has changed + shell: 'systemctl daemon-reload' + when: ccunit.changed and ansible_distribution_release == "jessie" + notify: restart carbon-cache + + - name: Install uwsgi graphite config template: src=uwsgi_graphite.ini.j2 dest=/etc/uwsgi/apps-available/graphite.ini diff --git a/templates/debian_carbon_service_systemd.j2 b/templates/debian_carbon_service_systemd.j2 new file mode 100644 index 0000000..9cc53df --- /dev/null +++ b/templates/debian_carbon_service_systemd.j2 @@ -0,0 +1,17 @@ +[Unit] +Description=carbon-cache +After=network.target + +[Service] +Environment="PYTHONPATH={{ graphite_install_path }}/lib:{{ graphite_install_path }}/webapp" + +# debug param seems required, otherwise carbon-cache +# just exits with code 0 and nothing is running +ExecStart={{ graphite_install_path }}/bin/carbon-cache.py --debug start +Restart=on-failure +User={{ graphite_user }} +Group={{ graphite_user }} +NoNewPrivileges=true + +[Install] +WantedBy=multi-user.target From af8a836e468a0d530e953e076948400367fa1ed0 Mon Sep 17 00:00:00 2001 From: georg Date: Thu, 24 Sep 2015 12:11:32 +0000 Subject: [PATCH 2/2] fix ubuntu, update meta file with jessie support --- meta/main.yml | 1 + tasks/Debian.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index 3268da1..13fc84c 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -97,6 +97,7 @@ galaxy_info: # - lenny # - squeeze - wheezy + - jessie # # Below are all categories currently available. Just as with # the platforms above, uncomment those that apply to your role. diff --git a/tasks/Debian.yml b/tasks/Debian.yml index a7bda41..a7de445 100644 --- a/tasks/Debian.yml +++ b/tasks/Debian.yml @@ -19,7 +19,7 @@ - name: Install init.d script for carbon-cache template: src=debian_carbon_service.j2 dest=/etc/init.d/carbon-cache notify: restart carbon-cache - when: ansible_distribution_release == "wheesy" + when: ansible_distribution_release == "wheesy" or ansible_distribution_release == "trusty" - name: Install systemd unit carbon-cache.service template: src=debian_carbon_service_systemd.j2 dest=/etc/systemd/system/carbon-cache.service @@ -30,7 +30,7 @@ file: path=/etc/init.d/{{ item }} mode=0755 owner=root group=root with_items: - carbon-cache - when: ansible_distribution_release == "wheesy" + when: ansible_distribution_release == "wheesy" or ansible_distribution_release == "trusty" - name: Reload systemd if unit file has changed shell: 'systemctl daemon-reload'