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

ansible-playbooks/general#85 Linting

parent f02df753
No related branches found
No related tags found
No related merge requests found
...@@ -55,8 +55,8 @@ Example: ...@@ -55,8 +55,8 @@ Example:
``` ```
sd_plugins: sd_plugins:
updatestatus: 'UpdateStatus.py' updatestatus: UpdateStatus.py
redis: 'Redis.py' redis: Redis.py
``` ```
This variable is expected to be defined as a set so that hash_behaviour=merge can be used so that you can define this variable in several of your groups and that this role is going to install the superset of all the group a specific host belings to. This variable is expected to be defined as a set so that hash_behaviour=merge can be used so that you can define this variable in several of your groups and that this role is going to install the superset of all the group a specific host belings to.
...@@ -68,9 +68,9 @@ The key of each entry should be unique across your inventory and the value is a ...@@ -68,9 +68,9 @@ The key of each entry should be unique across your inventory and the value is a
Default: Default:
``` ```
apache: 'none' apache: none
mysql: 'none' mysql: none
proxy: 'none' proxy: none
``` ```
Certain sections in the agent configuration are only relevant for certain hosts and by providing valid inventory group names for those sections (currently apache, mysql, proxy) you can make sure that for all hosts in those groups the relevant parts in the agent configuration get written to that host. Certain sections in the agent configuration are only relevant for certain hosts and by providing valid inventory group names for those sections (currently apache, mysql, proxy) you can make sure that for all hosts in those groups the relevant parts in the agent configuration get written to that host.
......
...@@ -2,23 +2,23 @@ ...@@ -2,23 +2,23 @@
# file: roles/serverdensity/defaults/main.yml # file: roles/serverdensity/defaults/main.yml
sd_update_remote: yes sd_update_remote: yes
sd_account: '' sd_account:
sd_url: '' sd_url:
sd_api_token: '' sd_api_token:
sd_api_cache_file: no sd_api_cache_file: no
sd_agent_key: '' sd_agent_key:
sd_logging_level: 'info' sd_logging_level: info
sd_alert_cleanup: no sd_alert_cleanup: no
sd_force_update: yes sd_force_update: yes
sd_groups: sd_groups:
apache: 'none' apache: none
mysql: 'none' mysql: none
proxy: 'none' proxy: none
sd_repo_public_key_uri: 'https://archive.serverdensity.com/sd-packaging-public.key' sd_repo_public_key_uri: https://archive.serverdensity.com/sd-packaging-public.key
sd_agent_plugins_dir: '/usr/share/python/sd-agent/checks.d/plugins' sd_agent_plugins_dir: /usr/share/python/sd-agent/checks.d/plugins
sd_plugins_files_dir: "{{ playbook_dir }}/files/sd-plugins" sd_plugins_files_dir: "{{ playbook_dir }}/files/sd-plugins"
sd_uninstallv1: no sd_uninstallv1: no
mysql_root_password: 'root' mysql_root_password: root
--- ---
# file: roles/serverdensity/handlers/main.yml # file: roles/serverdensity/handlers/main.yml
- name: "ServerDensity | Restart Agent" - name: ServerDensity | Restart Agent
service: service:
name=sd-agent name=sd-agent
state=restarted state=restarted
- name: "ServerDensity | Restart Apache" - name: ServerDensity | 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: ServerDensity | Apache | Install The Agent
apt: apt:
pkg=sd-agent-apache pkg=sd-agent-apache
state=present state=present
notify: "ServerDensity | Restart Agent" notify: "ServerDensity | Restart Agent"
- name: "ServerDensity | Apache | Configure The Agent" - name: ServerDensity | Apache | 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
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
mode='644' mode='644'
notify: "ServerDensity | Restart Agent" notify: "ServerDensity | Restart Agent"
- name: "ServerDensity | Apache | Enable some required modules" - name: ServerDensity | Apache | Enable some required modules
apache2_module: apache2_module:
name={{ item }} name={{ item }}
state=present state=present
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
- status - status
notify: "ServerDensity | Restart Apache" notify: "ServerDensity | Restart Apache"
- name: "ServerDensity | Apache | Configuration file for ServerDensity" - name: ServerDensity | Apache | 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') }}
...@@ -33,6 +33,6 @@ ...@@ -33,6 +33,6 @@
mode='644' mode='644'
notify: "ServerDensity | Restart Apache" notify: "ServerDensity | Restart Apache"
- name: "ServerDensity | Apache | Enable the sd-agent site" - name: ServerDensity | Apache | 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 creates=/etc/apache2/sites-enabled/sd-agent{{ apache_conf_ext|default('.conf') }}
notify: "ServerDensity | Restart Apache" notify: "ServerDensity | Restart Apache"
--- ---
# file: roles/serverdensity/tasks/main.yml # file: roles/serverdensity/tasks/main.yml
- name: "ServerDensity Role" - name: ServerDensity Role
set_fact: role_serverdensity_started=true set_fact:
tags: 'always' role_serverdensity_started: yes
tags:
- always
- block: - block:
- import_tasks: serverdensity.yml - import_tasks: serverdensity.yml
when: sd_api_token != '' when: sd_api_token != ''
when: '"serverdensity" not in excluded_roles' when: not excluded_roles or "serverdensity" not in excluded_roles
--- ---
# file: roles/serverdensity/tasks/mysql.yml # file: roles/serverdensity/tasks/mysql.yml
- name: "ServerDensity | MySQL | Install The Agent" - name: ServerDensity | MySQL | Install The Agent
apt: apt:
pkg=sd-agent-mysql pkg=sd-agent-mysql
state=present state=present
notify: "ServerDensity | Restart Agent" notify: "ServerDensity | Restart Agent"
- name: "ServerDensity | MySQL | Configure The Agent" - name: ServerDensity | MySQL | 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
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
- import_tasks: uninstallv1.yml - import_tasks: uninstallv1.yml
when: sd_uninstallv1 when: sd_uninstallv1
- name: "ServerDensity | Init SD plugin" - name: ServerDensity | Init SD plugin
local_action: local_action:
serverdensity serverdensity
api_token={{ sd_api_token }} api_token={{ sd_api_token }}
...@@ -13,38 +13,38 @@ ...@@ -13,38 +13,38 @@
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: ServerDensity | 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: ServerDensity | 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='644'
- name: "ServerDensity | Install The Agent" - name: ServerDensity | 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: "ServerDensity | Restart Agent"
- name: "ServerDensity | Create Plugins Directory" - name: ServerDensity | Create Plugins Directory
file: file:
dest={{ sd_agent_plugins_dir }} dest={{ sd_agent_plugins_dir }}
state=directory state=directory
mode='755' mode='755'
- name: "ServerDensity | Copy Plugins" - name: ServerDensity | 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: "ServerDensity | Restart Agent"
- name: "ServerDensity | Configure The Agent" - name: ServerDensity | Configure The Agent
template: template:
src={{ item }} src={{ item }}
dest=/etc/sd-agent/{{ item }} dest=/etc/sd-agent/{{ item }}
...@@ -52,9 +52,9 @@ ...@@ -52,9 +52,9 @@
group=root group=root
mode='644' mode='644'
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: "ServerDensity | Restart Agent"
......
...@@ -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: ServerDensity | 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: ServerDensity | 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: ServerDensity | 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