diff --git a/README.md b/README.md index b67bdce..104dbce 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,13 @@ roles * provides a lambda **MariaDB** server peered on ``127.0.0.1:3306`` with ``root`` MySQL password on ``~/.my.cnf`` * ownCloud * provides a simple instance of **ownCloud**, with ``NGINX, PHP5-FPM, and MariaDB`` -* xymon +* xymon-client and xymon-server * https://www.xymon.com/ * Provide installation of xymon server and xymon client monitoring system * Available for Debian (6 to 8) and Centos (6 to 7). **WARN** : xymon-server only for Debian (Centos dependencies are really hard to automate) * Configure apache for xymon-server * Configure xymon client and add the client in xymon server configuration to allow fetch data - * **Note** : Using xymon-client tag needs a working xymon-server (whenever the server was installed with the playbook or not) + * **Note** : Using xymon-client tag/role needs a working xymon-server (whenever the server was installed with the playbook or not) * Cloud be (theoretically, to be tested) used to update xymon server binaries to last stable release * ovzdb * http://projets.developpeur-neurasthenique.fr/projects/openvz-diff-backups diff --git a/roles/xymon/handlers/main.yml b/roles/xymon-client/handlers/main.yml similarity index 100% rename from roles/xymon/handlers/main.yml rename to roles/xymon-client/handlers/main.yml diff --git a/roles/xymon/tasks/client.yml b/roles/xymon-client/tasks/client.yml similarity index 100% rename from roles/xymon/tasks/client.yml rename to roles/xymon-client/tasks/client.yml diff --git a/roles/xymon/tasks/main.yml b/roles/xymon-client/tasks/main.yml similarity index 95% rename from roles/xymon/tasks/main.yml rename to roles/xymon-client/tasks/main.yml index 6d908ee..134373f 100644 --- a/roles/xymon/tasks/main.yml +++ b/roles/xymon-client/tasks/main.yml @@ -3,7 +3,7 @@ ## ## Role to install xymon client or xymon server on host depending what is needed ## -## Tags : +## Tags : ## - xymon-server : binaries and configuration server side ## - xymon-client : binaries and configuration client side (need a working server) ## - client-configuration : used to configure client only (no binaries) @@ -15,39 +15,39 @@ ##Check vars - name: check xymon_server fail: msg="Missing variable xymon_server" - tags: + tags: - xymon-client - xymon-server when: xymon_server is not defined - name: check xymon_checks fail: msg="Missing variable xymon_checks" - tags: + tags: - xymon-client - client-configuration when: xymon_checks is not defined - + - name: check monitoring_ip fail: msg="Missing variable monitoring_ip" - tags: + tags: - xymon-client - client-configuration when: monitoring_ip is not defined - name: check server htpasswd name fail: msg="Missing variable xymon_htname" - tags: + tags: - xymon-server - server-configuration when: xymon_htname is not defined - name: check server htpasswd password fail: msg="Missing variable xymon_htpasswd" - tags: + tags: - xymon-server - server-configuration when: xymon_htpasswd is not defined - + ## Custom Facts - name: Set Facts Debian @@ -58,12 +58,12 @@ client_name: "hobbit" client_name_cfg: "$HOBBITCLIENTHOME" client_name_logs: "$BBCLIENTLOGS" - tags: + tags: - xymon-client - xymon-server - configuration when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - + - name: Set Facts CentOs set_fact: xymon_cfg_path: "/etc/xymon-client/client.d" @@ -72,15 +72,11 @@ client_name: "xymon" client_name_cfg: "$XYMONCLIENTHOME" client_name_logs: "$XYMONCLIENTLOGS" - tags: + tags: - xymon-client - xymon-server - configuration when: ansible_distribution == 'CentOS' or ansible_distribution == 'CloudLinux' ##Main tasks -- include: server.yml - include: client.yml - - - diff --git a/roles/xymon-server/handlers/main.yml b/roles/xymon-server/handlers/main.yml new file mode 100644 index 0000000..a7e32f3 --- /dev/null +++ b/roles/xymon-server/handlers/main.yml @@ -0,0 +1,16 @@ +--- + +- name: restart xymon-hobbit-service + service: name={{ client_name }}-client state=restarted + +- name: reload xymon-hobbit-service + service: name={{ client_name }}-client state=reloaded + +- name: restart hobbit-client + service: name=hobbit-client state=restarted + +- name: restart xymon-client + service: name=xymon-client state=restarted + +- name: restart apache + service: name=apache2 state=restarted diff --git a/roles/xymon-server/tasks/main.yml b/roles/xymon-server/tasks/main.yml new file mode 100644 index 0000000..8bd90aa --- /dev/null +++ b/roles/xymon-server/tasks/main.yml @@ -0,0 +1,82 @@ +--- +## +## +## Role to install xymon client or xymon server on host depending what is needed +## +## Tags : +## - xymon-server : binaries and configuration server side +## - xymon-client : binaries and configuration client side (need a working server) +## - client-configuration : used to configure client only (no binaries) +## - client-packages : used only install client binaries (no configuration) +## - server-configuration : used to configure server only (no binaries) +## - server-packages : used to only install server binaries (no configuration) +######## + +##Check vars +- name: check xymon_server + fail: msg="Missing variable xymon_server" + tags: + - xymon-client + - xymon-server + when: xymon_server is not defined + +- name: check xymon_checks + fail: msg="Missing variable xymon_checks" + tags: + - xymon-client + - client-configuration + when: xymon_checks is not defined + +- name: check monitoring_ip + fail: msg="Missing variable monitoring_ip" + tags: + - xymon-client + - client-configuration + when: monitoring_ip is not defined + +- name: check server htpasswd name + fail: msg="Missing variable xymon_htname" + tags: + - xymon-server + - server-configuration + when: xymon_htname is not defined + +- name: check server htpasswd password + fail: msg="Missing variable xymon_htpasswd" + tags: + - xymon-server + - server-configuration + when: xymon_htpasswd is not defined + +## Custom Facts + +- name: Set Facts Debian + set_fact: + xymon_cfg_path: "/usr/lib/hobbit/client/etc/clientlaunch.d" + xymon_ext_path: "/usr/lib/hobbit/client/ext" + xymon_binary: "/usr/lib/hobbit/client/bin/bb" + client_name: "hobbit" + client_name_cfg: "$HOBBITCLIENTHOME" + client_name_logs: "$BBCLIENTLOGS" + tags: + - xymon-client + - xymon-server + - configuration + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + +- name: Set Facts CentOs + set_fact: + xymon_cfg_path: "/etc/xymon-client/client.d" + xymon_ext_path: "/etc/xymon-client/ext" + xymon_binary: "/usr/share/xymon-client/bin/xymon" + client_name: "xymon" + client_name_cfg: "$XYMONCLIENTHOME" + client_name_logs: "$XYMONCLIENTLOGS" + tags: + - xymon-client + - xymon-server + - configuration + when: ansible_distribution == 'CentOS' or ansible_distribution == 'CloudLinux' + +##Main tasks +- include: server.yml diff --git a/roles/xymon/tasks/server.yml b/roles/xymon-server/tasks/server.yml similarity index 100% rename from roles/xymon/tasks/server.yml rename to roles/xymon-server/tasks/server.yml diff --git a/xymon.yml b/xymon-client.yml similarity index 86% rename from xymon.yml rename to xymon-client.yml index 81e1b31..e14194d 100644 --- a/xymon.yml +++ b/xymon-client.yml @@ -5,4 +5,4 @@ user: root gather_facts: yes roles: - - xymon + - xymon-client diff --git a/xymon-server.yml b/xymon-server.yml new file mode 100644 index 0000000..5cc8046 --- /dev/null +++ b/xymon-server.yml @@ -0,0 +1,8 @@ +--- + +- name: Install and configure xymon-client or xymon-server + hosts: all + user: root + gather_facts: yes + roles: + - xymon-server