From 0d3689d39472f57fb2b972c78925ccfa3f8813f2 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Tue, 8 Mar 2016 10:52:40 +0100 Subject: [PATCH] Allow to exclude roles from plays with --exclude-roles command line parameter --- tasks/main.yml | 65 ++-------------------------------------- tasks/serverdensity.yml | 66 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 63 deletions(-) create mode 100644 tasks/serverdensity.yml diff --git a/tasks/main.yml b/tasks/main.yml index 0f377ac..9a45a39 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,66 +1,5 @@ --- # file: roles/serverdensity/tasks/main.yml -- include: uninstallv1.yml - when: sd_uninstallv1 - -- name: "ServerDensity | Init SD plugin" - local_action: - serverdensity - api_token={{ sd_api_token }} - cleanup={{ sd_alert_cleanup }} - force={{ sd_force_update }} - cache={{ sd_api_cache_file }} - when: sd_update_remote - -- name: "ServerDensity | Install Public Repo Key" - apt_key: - url={{ sd_repo_public_key_uri }} - state=present - -- name: "ServerDensity | Add ServerDensity Repository To Apt" - copy: - content='deb http://archive.serverdensity.com/ubuntu/ all main' - dest=/etc/apt/sources.list.d/sd-agent.list - mode=644 - -- name: "ServerDensity | Install The Agent" - apt: - pkg=sd-agent - state=installed - update_cache=yes - notify: "ServerDensity | Restart Agent" - -- name: "ServerDensity | Create Plugins Directory" - file: - dest={{ sd_agent_plugins_dir }} - state=directory - mode=755 - -- name: "ServerDensity | Copy Plugins" - copy: - src={{ sd_plugins_files_dir }}/{{ item }} - dest={{ sd_agent_plugins_dir }}/{{ item }} - with_items: '{{ sd_plugins }}' - when: sd_plugins|length > 0 - notify: "ServerDensity | Restart Agent" - -- name: "ServerDensity | Configure The Agent" - template: - src={{ item }} - dest=/etc/sd-agent/{{ item }} - owner=root - group=root - mode=0644 - with_items: - - 'config.cfg' - - 'plugins.cfg' - #- 'supervisor.conf' - when: sd_agent_key != '' - notify: "ServerDensity | Restart Agent" - -- include: apache.yml - when: sd_groups.apache != 'none' and inventory_hostname in groups[sd_groups.apache] - -- include: mysql.yml - when: sd_groups.mysql != 'none' and inventory_hostname in groups[sd_groups.mysql] +- include: serverdensity.yml + when: '"serverdensity" not in excluded_roles' diff --git a/tasks/serverdensity.yml b/tasks/serverdensity.yml new file mode 100644 index 0000000..ac13392 --- /dev/null +++ b/tasks/serverdensity.yml @@ -0,0 +1,66 @@ +--- +# file: roles/serverdensity/tasks/serverdensity.yml + +- include: uninstallv1.yml + when: sd_uninstallv1 + +- name: "ServerDensity | Init SD plugin" + local_action: + serverdensity + api_token={{ sd_api_token }} + cleanup={{ sd_alert_cleanup }} + force={{ sd_force_update }} + cache={{ sd_api_cache_file }} + when: sd_update_remote + +- name: "ServerDensity | Install Public Repo Key" + apt_key: + url={{ sd_repo_public_key_uri }} + state=present + +- name: "ServerDensity | Add ServerDensity Repository To Apt" + copy: + content='deb http://archive.serverdensity.com/ubuntu/ all main' + dest=/etc/apt/sources.list.d/sd-agent.list + mode=644 + +- name: "ServerDensity | Install The Agent" + apt: + pkg=sd-agent + state=installed + update_cache=yes + notify: "ServerDensity | Restart Agent" + +- name: "ServerDensity | Create Plugins Directory" + file: + dest={{ sd_agent_plugins_dir }} + state=directory + mode=755 + +- name: "ServerDensity | Copy Plugins" + copy: + src={{ sd_plugins_files_dir }}/{{ item }} + dest={{ sd_agent_plugins_dir }}/{{ item }} + with_items: '{{ sd_plugins }}' + when: sd_plugins|length > 0 + notify: "ServerDensity | Restart Agent" + +- name: "ServerDensity | Configure The Agent" + template: + src={{ item }} + dest=/etc/sd-agent/{{ item }} + owner=root + group=root + mode=0644 + with_items: + - 'config.cfg' + - 'plugins.cfg' + #- 'supervisor.conf' + when: sd_agent_key != '' + notify: "ServerDensity | Restart Agent" + +- include: apache.yml + when: sd_groups.apache != 'none' and inventory_hostname in groups[sd_groups.apache] + +- include: mysql.yml + when: sd_groups.mysql != 'none' and inventory_hostname in groups[sd_groups.mysql] -- GitLab