Skip to content
Snippets Groups Projects
Commit 217253e4 authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-playbooks/general#85 Linting [skip-ci]

parent e7fd0d22
No related branches found
No related tags found
No related merge requests found
---
# file: roles/serverdensity/handlers/main.yml
- name: ServerDensity | Restart Agent
- name: Restart Agent
service:
name=sd-agent
state=restarted
name: sd-agent
state: restarted
- name: ServerDensity | Restart Apache
- name: Restart Apache
service:
name=apache2
state=restarted
name: apache2
state: restarted
---
# file: roles/serverdensity/tasks/apache.yml
- name: ServerDensity | Apache | Install The Agent
- name: Install The Agent
apt:
pkg=sd-agent-apache
state=present
notify: "ServerDensity | Restart Agent"
pkg: sd-agent-apache
state: present
notify:
- Restart Agent
- name: ServerDensity | Apache | Configure The Agent
- name: Configure The Agent
template:
src=apache.yaml
dest=/etc/sd-agent/conf.d/apache.yaml
owner=root
group=root
mode='644'
notify: "ServerDensity | Restart Agent"
src: apache.yaml
dest: /etc/sd-agent/conf.d/apache.yaml
owner: root
group: root
mode: 0644
notify:
- Restart Agent
- name: ServerDensity | Apache | Enable some required modules
- name: Enable some required modules
apache2_module:
name={{ item }}
state=present
name: '{{ item }}'
state: present
with_items:
- status
notify: "ServerDensity | Restart Apache"
notify:
- Restart Apache
- name: ServerDensity | Apache | Configuration file for ServerDensity
- name: Configuration file for ServerDensity
template:
src=etc-apache2-sites-available-sd-agent
dest=/etc/apache2/sites-available/sd-agent{{ apache_conf_ext|default('.conf') }}
owner=root
group=root
mode='644'
notify: "ServerDensity | Restart Apache"
src: etc-apache2-sites-available-sd-agent
dest: /etc/apache2/sites-available/sd-agent{{ apache_conf_ext|default('.conf') }}
owner: root
group: root
mode: 0644
notify:
- Restart Apache
- name: ServerDensity | Apache | Enable the sd-agent site
command: a2ensite sd-agent creates=/etc/apache2/sites-enabled/sd-agent{{ apache_conf_ext|default('.conf') }}
notify: "ServerDensity | Restart Apache"
- name: Enable the sd-agent site
command: a2ensite sd-agent
args:
creates: /etc/apache2/sites-enabled/sd-agent{{ apache_conf_ext|default('.conf') }}
notify:
- Restart Apache
---
# file: roles/serverdensity/tasks/mysql.yml
- name: ServerDensity | MySQL | Install The Agent
- name: Install The Agent
apt:
pkg=sd-agent-mysql
state=present
notify: "ServerDensity | Restart Agent"
pkg: sd-agent-mysql
state: present
notify:
- Restart Agent
- name: ServerDensity | MySQL | Configure The Agent
- name: Configure The Agent
template:
src=mysql.yaml
dest=/etc/sd-agent/conf.d/mysql.yaml
owner=root
group=root
mode='644'
notify: "ServerDensity | Restart Agent"
src: mysql.yaml
dest: /etc/sd-agent/conf.d/mysql.yaml
owner: root
group: root
mode: 0644
notify:
- Restart Agent
......@@ -4,59 +4,61 @@
- import_tasks: 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 }}
- name: 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
- name: Install Public Repo Key
apt_key:
url={{ sd_repo_public_key_uri }}
state=present
url: '{{ sd_repo_public_key_uri }}'
state: present
- name: ServerDensity | Add ServerDensity Repository To Apt
- name: 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'
content: deb http://archive.serverdensity.com/ubuntu/ all main
dest: /etc/apt/sources.list.d/sd-agent.list
mode: 0644
- name: ServerDensity | Install The Agent
- name: Install The Agent
apt:
pkg=sd-agent
state=present
update_cache=yes
notify: "ServerDensity | Restart Agent"
pkg: sd-agent
state: present
update_cache: yes
notify:
- Restart Agent
- name: ServerDensity | Create Plugins Directory
- name: Create Plugins Directory
file:
dest={{ sd_agent_plugins_dir }}
state=directory
mode='755'
dest: '{{ sd_agent_plugins_dir }}'
state: directory
mode: 0755
- name: ServerDensity | Copy Plugins
- name: Copy Plugins
copy:
src={{ sd_plugins_files_dir }}/{{ item }}
dest={{ sd_agent_plugins_dir }}/{{ item }}
src: '{{ sd_plugins_files_dir }}/{{ item }}'
dest: '{{ sd_agent_plugins_dir }}/{{ item }}'
with_items: '{{ sd_plugins|default([]) }}'
notify: "ServerDensity | Restart Agent"
notify:
- Restart Agent
- name: ServerDensity | Configure The Agent
- name: Configure The Agent
template:
src={{ item }}
dest=/etc/sd-agent/{{ item }}
owner=root
group=root
mode='644'
src: '{{ item }}'
dest: '/etc/sd-agent/{{ item }}'
owner: root
group: root
mode: 0644
with_items:
- config.cfg
- plugins.cfg
#- supervisor.conf
# - supervisor.conf
when: sd_agent_key != ''
notify: "ServerDensity | Restart Agent"
notify:
- Restart Agent
- import_tasks: apache.yml
when: sd_groups.apache != 'none' and inventory_hostname in groups[sd_groups.apache]
......
......@@ -2,19 +2,19 @@
# file: roles/serverdensity/tasks/uninstallv1.yml
# Stop agent
- name: ServerDensity | Stop v1 Agent
- name: Stop v1 Agent
service:
name=sd-agent
state=stopped
name: sd-agent
state: stopped
# Uninstall agent
- name: ServerDensity | Uninstall v1 Agent
- name: Uninstall v1 Agent
apt:
pkg=sd-agent
state=absent
pkg: sd-agent
state: absent
# Remove /usr/bin/sd-agent
- name: ServerDensity | Remove Plugins Directory
- name: Remove Plugins Directory
file:
dest=/usr/bin/sd-agent
state=absent
dest: /usr/bin/sd-agent
state: absent
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment