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 # file: roles/serverdensity/handlers/main.yml
- name: ServerDensity | Restart Agent - name: Restart Agent
service: service:
name=sd-agent name: sd-agent
state=restarted state: restarted
- name: ServerDensity | Restart Apache - name: Restart Apache
service: service:
name=apache2 name: apache2
state=restarted state: restarted
--- ---
# file: roles/serverdensity/tasks/apache.yml # file: roles/serverdensity/tasks/apache.yml
- name: ServerDensity | Apache | Install The Agent - name: Install The Agent
apt: apt:
pkg=sd-agent-apache pkg: sd-agent-apache
state=present state: present
notify: "ServerDensity | Restart Agent" notify:
- Restart Agent
- name: ServerDensity | Apache | Configure The Agent - name: Configure The Agent
template: template:
src=apache.yaml src: apache.yaml
dest=/etc/sd-agent/conf.d/apache.yaml dest: /etc/sd-agent/conf.d/apache.yaml
owner=root owner: root
group=root group: root
mode='644' mode: 0644
notify: "ServerDensity | Restart Agent" notify:
- Restart Agent
- name: ServerDensity | Apache | Enable some required modules - name: Enable some required modules
apache2_module: apache2_module:
name={{ item }} name: '{{ item }}'
state=present state: present
with_items: with_items:
- status - status
notify: "ServerDensity | Restart Apache" notify:
- Restart Apache
- name: ServerDensity | Apache | Configuration file for ServerDensity - name: Configuration file for ServerDensity
template: template:
src=etc-apache2-sites-available-sd-agent src: etc-apache2-sites-available-sd-agent
dest=/etc/apache2/sites-available/sd-agent{{ apache_conf_ext|default('.conf') }} dest: /etc/apache2/sites-available/sd-agent{{ apache_conf_ext|default('.conf') }}
owner=root owner: root
group=root group: root
mode='644' mode: 0644
notify: "ServerDensity | Restart Apache" notify:
- Restart Apache
- name: ServerDensity | Apache | Enable the sd-agent site - name: Enable the sd-agent site
command: a2ensite sd-agent creates=/etc/apache2/sites-enabled/sd-agent{{ apache_conf_ext|default('.conf') }} command: a2ensite sd-agent
notify: "ServerDensity | Restart Apache" args:
creates: /etc/apache2/sites-enabled/sd-agent{{ apache_conf_ext|default('.conf') }}
notify:
- Restart Apache
--- ---
# file: roles/serverdensity/tasks/mysql.yml # file: roles/serverdensity/tasks/mysql.yml
- name: ServerDensity | MySQL | Install The Agent - name: Install The Agent
apt: apt:
pkg=sd-agent-mysql pkg: sd-agent-mysql
state=present state: present
notify: "ServerDensity | Restart Agent" notify:
- Restart Agent
- name: ServerDensity | MySQL | Configure The Agent - name: Configure The Agent
template: template:
src=mysql.yaml src: mysql.yaml
dest=/etc/sd-agent/conf.d/mysql.yaml dest: /etc/sd-agent/conf.d/mysql.yaml
owner=root owner: root
group=root group: root
mode='644' mode: 0644
notify: "ServerDensity | Restart Agent" notify:
- Restart Agent
...@@ -4,59 +4,61 @@ ...@@ -4,59 +4,61 @@
- import_tasks: uninstallv1.yml - import_tasks: uninstallv1.yml
when: sd_uninstallv1 when: sd_uninstallv1
- name: ServerDensity | Init SD plugin - name: Init SD plugin
local_action: local_action: serverdensity
serverdensity api_token: '{{ sd_api_token }}'
api_token={{ sd_api_token }} cleanup: '{{ sd_alert_cleanup }}'
cleanup={{ sd_alert_cleanup }} force: '{{ sd_force_update }}'
force={{ sd_force_update }} cache: '{{ sd_api_cache_file }}'
cache={{ sd_api_cache_file }}
when: sd_update_remote when: sd_update_remote
- name: ServerDensity | Install Public Repo Key - name: Install Public Repo Key
apt_key: apt_key:
url={{ sd_repo_public_key_uri }} url: '{{ sd_repo_public_key_uri }}'
state=present state: present
- name: ServerDensity | Add ServerDensity Repository To Apt - name: Add ServerDensity Repository To Apt
copy: copy:
content='deb http://archive.serverdensity.com/ubuntu/ all main' content: deb http://archive.serverdensity.com/ubuntu/ all main
dest=/etc/apt/sources.list.d/sd-agent.list dest: /etc/apt/sources.list.d/sd-agent.list
mode='644' mode: 0644
- name: ServerDensity | Install The Agent - name: Install The Agent
apt: apt:
pkg=sd-agent pkg: sd-agent
state=present state: present
update_cache=yes update_cache: yes
notify: "ServerDensity | Restart Agent" notify:
- Restart Agent
- name: ServerDensity | Create Plugins Directory - name: Create Plugins Directory
file: file:
dest={{ sd_agent_plugins_dir }} dest: '{{ sd_agent_plugins_dir }}'
state=directory state: directory
mode='755' mode: 0755
- name: ServerDensity | Copy Plugins - name: Copy Plugins
copy: copy:
src={{ sd_plugins_files_dir }}/{{ item }} src: '{{ sd_plugins_files_dir }}/{{ item }}'
dest={{ sd_agent_plugins_dir }}/{{ item }} dest: '{{ sd_agent_plugins_dir }}/{{ item }}'
with_items: '{{ sd_plugins|default([]) }}' with_items: '{{ sd_plugins|default([]) }}'
notify: "ServerDensity | Restart Agent" notify:
- Restart Agent
- name: ServerDensity | Configure The Agent - name: Configure The Agent
template: template:
src={{ item }} src: '{{ item }}'
dest=/etc/sd-agent/{{ item }} dest: '/etc/sd-agent/{{ item }}'
owner=root owner: root
group=root group: root
mode='644' mode: 0644
with_items: with_items:
- config.cfg - config.cfg
- plugins.cfg - plugins.cfg
#- supervisor.conf # - supervisor.conf
when: sd_agent_key != '' when: sd_agent_key != ''
notify: "ServerDensity | Restart Agent" notify:
- Restart Agent
- import_tasks: apache.yml - import_tasks: apache.yml
when: sd_groups.apache != 'none' and inventory_hostname in groups[sd_groups.apache] when: sd_groups.apache != 'none' and inventory_hostname in groups[sd_groups.apache]
......
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
# file: roles/serverdensity/tasks/uninstallv1.yml # file: roles/serverdensity/tasks/uninstallv1.yml
# Stop agent # Stop agent
- name: ServerDensity | Stop v1 Agent - name: Stop v1 Agent
service: service:
name=sd-agent name: sd-agent
state=stopped state: stopped
# Uninstall agent # Uninstall agent
- name: ServerDensity | Uninstall v1 Agent - name: Uninstall v1 Agent
apt: apt:
pkg=sd-agent pkg: sd-agent
state=absent state: absent
# Remove /usr/bin/sd-agent # Remove /usr/bin/sd-agent
- name: ServerDensity | Remove Plugins Directory - name: Remove Plugins Directory
file: file:
dest=/usr/bin/sd-agent dest: /usr/bin/sd-agent
state=absent 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