Created
August 5, 2018 12:29
-
-
Save neingeist/e236bd7e11255d213b4e412a7a58cf8d to your computer and use it in GitHub Desktop.
ansible playbook to install collectd and collectd graph panel on debian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: bigmother | |
remote_user: root | |
tasks: | |
- block: | |
- name: "install collectd" | |
apt: name=collectd | |
- name: "install custom collectd config" | |
copy: | |
src: collectd.conf.d/{{ item }} | |
dest: /etc/collectd/collectd.conf.d | |
with_items: | |
- ping-maxipax.conf | |
notify: restart collectd | |
- block: | |
- name: "install cgp deps" | |
apt: name={{ item }} | |
with_items: | |
- php-json | |
- libapache2-mod-php | |
- rrdtool | |
- name: "enable apache mod php7.0" | |
apache2_module: name=php7.0 | |
notify: restart apache2 | |
- name: "install cgp" | |
git: | |
repo: https://github.com/pommi/CGP.git | |
version: v1 | |
dest: /var/www/html/CGP-git | |
force: yes | |
- name: "symlink cgp to /cgp" | |
file: src=CGP-git dest=/var/www/html/cgp state=link | |
- name: "create /etc/cgp" | |
file: dest=/etc/cgp state=directory | |
- name: "move cgp config to /etc" | |
command: mv /var/www/html/cgp/conf/config.php /etc/cgp/ | |
args: | |
creates: /etc/cgp/config.php | |
- name: "symlink cgp config back to /var/www" | |
file: | |
src=/etc/cgp/config.php | |
dest=/var/www/html/cgp/conf/config.php | |
state=link | |
force=yes # needed when updating cgp | |
- name: "configure cgp graph type" | |
lineinfile: | |
dest: /etc/cgp/config.php | |
line: "$CONFIG['graph_type'] = 'hybrid';" | |
regexp: '^\$CONFIG\[.graph_type.] = ' | |
handlers: | |
- name: restart apache2 | |
service: name=apache2 state=restarted | |
- name: restart collectd | |
service: name=collectd state=restarted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment