From 608de164cbea7f58dde7bde0fd53e9053c479d37 Mon Sep 17 00:00:00 2001 From: Reto Gantenbein Date: Sat, 25 Jun 2016 22:24:47 +0200 Subject: [PATCH] Playbook (documentation) update, remove dependencies Don't hard-depend on roles anymore (see debops/debops-playbooks#192). Include example playbook instead of inlining it (see debops/docs#145). --- docs/getting-started.rst | 19 +++++++++--- docs/index.rst | 5 ++-- docs/installation.rst | 16 ---------- docs/introduction.rst | 11 +++++++ docs/playbooks/checkmk_agent.yml | 51 ++++++++++++++++++++++++++++++++ meta/main.yml | 44 ++------------------------- 6 files changed, 81 insertions(+), 65 deletions(-) delete mode 100644 docs/installation.rst create mode 100644 docs/playbooks/checkmk_agent.yml diff --git a/docs/getting-started.rst b/docs/getting-started.rst index 6cab9ca..8a62fd4 100644 --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -1,3 +1,14 @@ +Getting started +=============== + +Example playbook +---------------- + +Here's an example playbook that uses the ``debops-contrib.checkmk_agent`` role: + +.. literalinclude:: playbooks/checkmk_agent.yml + :language: yaml + Ansible tags ------------ @@ -18,16 +29,16 @@ Available role tags: this to omit them using ``--skip-tags`` parameter. ``depend-of::checkmk_agent`` - Execute all ``debops.contrib-checkmk_agent`` role dependencies in its context. + Execute all ``debops-contrib.checkmk_agent`` role dependencies in its context. ``depend::apt_preferences:checkmk_agent`` - Run ``debops.apt_preferences`` dependent role in ``debops.contrib-checkmk_agent`` context. + Run ``debops.apt_preferences`` dependent role in ``debops-contrib.checkmk_agent`` context. ``depend::etc_services:checkmk_agent`` - Run ``debops.etc_services`` dependent role in ``debops.contrib-checkmk_agent`` context. + Run ``debops.etc_services`` dependent role in ``debops-contrib.checkmk_agent`` context. ``depend::ferm:checkmk_agent`` - Run ``debops.ferm`` dependent role in ``debops.contrib-checkmk_agent`` context. + Run ``debops.ferm`` dependent role in ``debops-contrib.checkmk_agent`` context. ``role::checkmk_agent:plugins`` Run tasks related to Check_MK agent plugin configuration. diff --git a/docs/index.rst b/docs/index.rst index ad94f6b..cd4f680 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,13 +1,12 @@ -.. _debops.contrib-checkmk_agent: +.. _debops-contrib.checkmk_agent: -Ansible role: debops.contrib-checkmk_agent +Ansible role: debops-contrib.checkmk_agent ========================================== .. toctree:: :maxdepth: 2 introduction - installation getting-started defaults copyright diff --git a/docs/installation.rst b/docs/installation.rst deleted file mode 100644 index f68cbc1..0000000 --- a/docs/installation.rst +++ /dev/null @@ -1,16 +0,0 @@ -Installation -============ - -This role requires at least Ansible ``v1.7.0``. To install it, clone it -to your `DebOps`_ project roles directory:: - - git clone https://github.com/debops-contrib/ansible-checkmk_agent.git - -.. _DebOps: http://debops.org/ - -Role dependencies -~~~~~~~~~~~~~~~~~ - -- ``debops.apt_preferences`` -- ``debops.etc_services`` -- ``debops.ferm`` diff --git a/docs/introduction.rst b/docs/introduction.rst index f4b6bfb..a4d5cd2 100644 --- a/docs/introduction.rst +++ b/docs/introduction.rst @@ -8,6 +8,17 @@ suite. .. _Ansible: http://ansible.com/ .. _Check_MK: https://mathias-kettner.com/check_mk.html + +Installation +~~~~~~~~~~~~ + +This role requires at least Ansible ``v1.9.0``. To install it, clone it +to your `DebOps`_ project roles directory:: + + git clone https://github.com/debops-contrib/ansible-checkmk_agent.git debops-contrib.ansible_checkmk_agent + +.. _DebOps: http://debops.org/ + .. Local Variables: mode: rst diff --git a/docs/playbooks/checkmk_agent.yml b/docs/playbooks/checkmk_agent.yml new file mode 100644 index 0000000..7777777 --- /dev/null +++ b/docs/playbooks/checkmk_agent.yml @@ -0,0 +1,51 @@ +--- + +- name: Manage Check_MK agent + hosts: [ 'debops_service_checkmk_agent', 'debops_checkmk_agent' ] + become: True + + roles: + - role: debops.apt_preferences + tags: [ 'depend::apt_preferences', 'depend::apt_preferences:checkmk_agent', + 'depend-of::checkmk_agent', 'type::dependency' ] + apt_preferences__dependent_list: + - package: 'check-mk' + backports: [ 'jessie' ] + reason: 'Package not available in stable Debian Jessie' + by_role: 'debops.contrib-checkmk_agent' + + - role: debops.etc_services + tags: [ 'depend::etc_services', 'depend::etc_services:checkmk_agent', + 'depend-of::checkmk_agent', 'type::dependency' ] + etc_services__dependent_list: + - name: 'check-mk-agent' + port: '{{ checkmk_agent__port }}' + comment: 'Check_MK agent (via xinetd)' + when: (checkmk_agent|d() and 'xinetd' in checkmk_agent) + + - role: debops.ferm + tags: [ 'depend::ferm', 'depend::ferm:checkmk_agent', + 'depend-of::checkmk_agent', 'type::dependency' ] + ferm__dependent_rules: '{{ checkmk_agent__ferm_dependent_rules }}' + when: (checkmk_agent|d() and 'xinetd' in checkmk_agent) + + - role: debops.mariadb + tags: [ 'depend::mariadb', 'depend::mariadb:checkmk_agent', + 'depend-of::checkmk_agent', 'type::dependency' ] + mariadb__users: + - user: '{{ checkmk_agent__plugin_mysql_user }}' + password: '{{ checkmk_agent__plugin_mysql_password }}' + priv: '{{ checkmk_agent__plugin_mysql_priv }}' + priv_default: False + priv_aux: False + append_privs: False + owner: 'root' + creds_path: '/etc/check_mk/mysql.cfg' + when: (("mk_mysql" in checkmk_agent__plugin_list and + checkmk_agent__plugin_mysql|d("automatic") == "automatic") or + ((checkmk_agent__plugin_autodetect|d(True) | bool) and + "debops_mariadb_server" in hostvars[inventory_hostname]["group_names"]) + ) + + - role: debops-contrib.checkmk_agent + tags: [ 'role::checkmk_agent' ] diff --git a/meta/main.yml b/meta/main.yml index ac97926..33e6210 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,46 +1,6 @@ --- -dependencies: - - - role: debops.apt_preferences - tags: [ 'depend::apt_preferences', 'depend::apt_preferences:checkmk_agent', - 'depend-of::checkmk_agent', 'type::dependency' ] - apt_preferences__dependent_list: - - package: 'check-mk' - backports: [ 'jessie' ] - reason: 'Package not available in stable Debian Jessie' - by_role: 'debops.contrib-checkmk_agent' - - - role: debops.etc_services - tags: [ 'depend::etc_services', 'depend::etc_services:checkmk_agent', - 'depend-of::checkmk_agent', 'type::dependency' ] - etc_services__dependent_list: - - name: 'check-mk-agent' - port: '{{ checkmk_agent__port }}' - comment: 'Check_MK agent (via xinetd)' - when: (checkmk_agent|d() and 'xinetd' in checkmk_agent) - - - role: debops.ferm - tags: [ 'depend::ferm', 'depend::ferm:checkmk_agent', - 'depend-of::checkmk_agent', 'type::dependency' ] - ferm__dependent_rules: '{{ checkmk_agent__ferm_dependent_rules }}' - when: (checkmk_agent|d() and 'xinetd' in checkmk_agent) - - - role: debops.mariadb - mariadb__users: - - user: '{{ checkmk_agent__plugin_mysql_user }}' - password: '{{ checkmk_agent__plugin_mysql_password }}' - priv: '{{ checkmk_agent__plugin_mysql_priv }}' - priv_default: False - priv_aux: False - append_privs: False - owner: 'root' - creds_path: '/etc/check_mk/mysql.cfg' - when: (("mk_mysql" in checkmk_agent__plugin_list and checkmk_agent__plugin_mysql|d("automatic") == "automatic") or - ((checkmk_agent__plugin_autodetect|d(True) | bool) and "debops_mariadb_server" in hostvars[inventory_hostname]["group_names"]) - ) - tags: [ 'depend::mariadb', 'depend::mariadb:checkmk_agent', - 'depend-of::checkmk_agent', 'type::dependency' ] +dependencies: [] galaxy_info: @@ -48,7 +8,7 @@ galaxy_info: author: 'Reto Gantenbein, Robin Schneider' description: 'Setup Check_MK monitoring agent' license: 'GNU General Public License v3' - min_ansible_version: '1.7.0' + min_ansible_version: '1.9.0' platforms: