diff --git a/defaults/main.yml b/defaults/main.yml index c9f3c1296c9ddc90fa426cfb6e3979f4c35b5de9..0dd83583461fb39a3a0dcbac123855752905c609 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,3 +11,10 @@ sd_groups: apache: 'none' mysql: 'none' proxy: 'none' + + +sd_repo_public_key_uri: 'https://www.serverdensity.com/downloads/boxedice-public.key' +sd_agent_plugins_dir: '/usr/bin/sd-agent/plugins' +sd_plugins_files_dir: "{{inventory_dir}}/files/sd-plugins" +sd_template_config: 'config.cfg' +... diff --git a/tasks/main.yml b/tasks/main.yml index 861262297f8af2b5f4561cc0d85895103ed48f49..9487d6e669fd8031a85c6a908aa786a0f13aff58 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -11,7 +11,7 @@ - name: 'ServerDensity | Install Public Repo Key' apt_key: - url='https://www.serverdensity.com/downloads/boxedice-public.key' + url="{{ sd_repo_public_key_uri }}" state=present - name: 'ServerDensity | Add ServerDensity Repository To Apt' @@ -29,19 +29,20 @@ - name: 'ServerDensity | Create Plugins Directory' file: - dest='/usr/bin/sd-agent/plugins' + dest="{{ sd_agent_plugins_dir }}" state=directory mode=755 - name: 'ServerDensity | Copy Plugins' copy: - src={{inventory_dir}}/files/sd-plugins/{{item.1}} - dest=/usr/bin/sd-agent/plugins/{{item.1}} + src="{{ sd_plugins_files_dir }}/{{item.1}}" + dest="{{ sd_agent_plugins_dir }}/{{item.1}}" with_items: sd_plugins|dictsort + when: sd_plugins|length > 0 notify: 'ServerDensity | Restart Agent' - name: 'ServerDensity | Configure The Agent' - template: src=config.cfg + template: src="{{ sd_template_config }}" dest=/etc/sd-agent/config.cfg owner=root group=root diff --git a/templates/config.cfg b/templates/config.cfg index e2632d24650b1719003f9f872ce87ed75de4c002..e697d88242387b970e6694ccc4534a6390650b45 100644 --- a/templates/config.cfg +++ b/templates/config.cfg @@ -6,7 +6,7 @@ sd_url: {{sd_url}} agent_key: {{sd_agent_key}} -plugin_directory: /usr/bin/sd-agent/plugins +plugin_directory: {{ sd_agent_plugins_dir }} logging_level: {{sd_logging_level}} {% if sd_groups.apache != 'none' and inventory_hostname in groups[sd_groups.apache] %}