Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ansible-checkmk_agent for rework-4 #2

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1864112
Add tests for debops.checkmk_server
ganto May 28, 2016
7f63450
Make test script executable
ganto May 29, 2016
a3926a1
Use stable version to avoid Ansible bugs
ganto May 29, 2016
964bb16
Switch back to stable-2.0 branch due to 'apt' module bug
ganto May 29, 2016
96ac31d
Add tests for debops.checkmk_agent
ganto May 29, 2016
46fe6ef
Adjust variable namespacing to role changes
ganto May 30, 2016
feff28e
Add tests for debops.ansible-roundcube
ganto May 30, 2016
f73a906
Fix path test
ganto Jun 9, 2016
64804f9
Install debops.mariadb role
ganto Jun 9, 2016
9c3c981
Adjust variable names according to namespace change
ganto Jun 14, 2016
e4027c9
Adjust playbook according to debops-contrib/checkmk_server#14
ganto Jun 24, 2016
a3377e8
Use new variables for dependant role configuration
ganto Jun 25, 2016
4b3d89c
Install debops.mariadb role for checkmk_agent test
ganto Jun 25, 2016
18bbc43
Fix reference to ansible-checkmk_agent role
ganto Jun 25, 2016
8c14fe3
Adjust test to latest playbook and role changes
ganto Jul 30, 2016
5bedc26
Define dummy ssh public key, assert authorized_keys and sudoers
ganto Jul 30, 2016
f3144dc
Fix typo in path name
ganto Jul 30, 2016
6b018ed
Fix path of sudoers file
ganto Jul 30, 2016
8653a06
Adjust playbook to f4a7f63
ganto Aug 3, 2016
8ace871
Add tests for ansible-gdnsd
ganto Sep 20, 2016
df213f9
Avoid startup error when trying to bind to all addresses
ganto Sep 20, 2016
73ca383
Add various assert checks for gdnsd service
ganto Sep 21, 2016
bae4f8a
Also bind to localhost for easier query test
ganto Sep 21, 2016
15cd5b3
Make assert checks more informative
ganto Sep 21, 2016
7027005
Add 'debops-contrib.kibana' test
ganto Oct 17, 2016
9c83cec
Add ferm dependencies and iptables assert
ganto Oct 18, 2016
c83f8f4
Add 'debops-contrib.elasticbeats' test
ganto Oct 20, 2016
1f90475
Don't check process names with full path
ganto Oct 20, 2016
47d1e89
Test TemplateNotFound error with Ansible 2.1
ganto Oct 25, 2016
e409640
Use default Ansible version from upstream tests (currently 2.2)
ganto Oct 26, 2016
95b97c4
Adjust path to Kibana-5.0
ganto Oct 27, 2016
77a4879
Don't use Ubuntu repository for testing
ganto Oct 27, 2016
adf0802
Assert status of ssh jail
ganto Mar 15, 2017
cb6a0c5
Make test command more verbose
ganto Mar 15, 2017
b15bcd0
Let's try it with sudo
ganto Mar 16, 2017
80876ee
Update ansible-checkmk_agent for rework-4
ypid Apr 14, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# define dummy ssh public key
checkmk_agent__user_key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnHO+mKFHa6NvszevpqrWpX75M/Hux9lFl41B0VEd4btweMccpE2NzJDJy7zXPtSaDmWWIRriF56Gxw9ovOZN0NG7DSUQ0P+7+Rd0Oom8HAKX5tlBAkKEhKA2smcp0tUyZKt+BNGqTcM5NNp5Wycct6+QYMOw0E7apqrKxHpFhv5z8uK7jgGu396cbGfUSwXeja96f7kjqvH+CSktCakqhpC8gTNhcZjtPW4OnB7yLmBsvk00eIAQfmRJGo/OcEWeL7k0VYva9MVPD7aeyNENDnlJWA4qmcTBn39sQYdC1wiCipXGjd45+nYxJuV/+5b1HHicm3LG9Tg28Bew7EM8b travis'
1 change: 1 addition & 0 deletions ansible-checkmk_agent/inventory/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
placeholder_fqdn
36 changes: 36 additions & 0 deletions ansible-checkmk_agent/playbooks/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---

- hosts: 'placeholder_fqdn'
become: True

roles:

- role: ansible-checkmk_agent/env

- role: debops.apt_preferences
apt_preferences__dependent_list:
- '{{ checkmk_agent__apt_preferences__dependent_list }}'

- role: debops.etc_services
etc_services__dependent_list:
- '{{ checkmk_agent__etc_services__dependent_list }}'
when: ('xinetd' in checkmk_agent__type)

- role: debops.ferm
ferm__dependent_rules:
- '{{ checkmk_agent__ferm__dependent_rules }}'

- role: debops.tcpwrappers
tcpwrappers__dependent_allow:
- '{{ checkmk_agent__tcpwrappers__dependent_allow }}'

- role: debops.authorized_keys
authorized_keys__dependent_list:
- '{{ checkmk_agent__authorized_keys__dependent_list }}'

- role: debops.mariadb
mariadb__dependent_users:
- '{{ checkmk_agent__mariadb__dependent_users }}'
when: ("mk_mysql" in checkmk_agent__combined_plugins)

- role: ansible-checkmk_agent
36 changes: 36 additions & 0 deletions ansible-checkmk_agent/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# test: Test debops.checkmk_server
# Copyright (C) 2014 Nick Janetakis <[email protected]>
# Part of the DebOps project - http://debops.org/


. "${ROLESPEC_LIB}/main"
. "${ROLESPEC_TEST}/../defaults.conf"


install_ansible ${test_ansible_version}
ansible_plugins

ansible-galaxy -f install debops.apt_preferences
ansible-galaxy -f install debops.authorized_keys
ansible-galaxy -f install debops.etc_services
ansible-galaxy -f install debops.ferm
ansible-galaxy -f install debops.tcpwrappers
ansible-galaxy -f install debops.mariadb

assert_playbook_check_runs
assert_playbook_idempotent


assert_path '/etc/check_mk'
assert_path '/usr/bin/check_mk_agent'

assert_group 'checkmk'
assert_exit_code 'getent passwd checkmk' 0

assert_path '/etc/ssh/authorized_keys/checkmk'
assert_path '/etc/sudoers.d/check-mk-agent'


assert_docs
1 change: 1 addition & 0 deletions ansible-checkmk_server/inventory/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
placeholder_fqdn
12 changes: 12 additions & 0 deletions ansible-checkmk_server/playbooks/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---

- hosts: 'placeholder_fqdn'
become: True

roles:

- role: debops.ferm
ferm__dependent_rules:
- '{{ checkmk_server__ferm_dependent_rules }}'

- role: ansible-checkmk_server
30 changes: 30 additions & 0 deletions ansible-checkmk_server/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# test: Test debops.checkmk_server
# Copyright (C) 2014 Nick Janetakis <[email protected]>
# Part of the DebOps project - http://debops.org/


. "${ROLESPEC_LIB}/main"
. "${ROLESPEC_TEST}/../defaults.conf"


install_ansible ${test_ansible_version}
ansible_plugins

ansible-galaxy -f install debops.ferm

assert_playbook_check_runs
assert_playbook_idempotent


assert_path '/omd/sites/debops'
assert_path '/omd/sites/debops/etc/check_mk/conf.d/wato/global.mk'
assert_path '/omd/sites/debops/etc/check_mk/conf.d/wato/rules.mk'

assert_running 'apache2'
assert_running 'icinga'

assert_url 'http://localhost/debops/' '(200|302)'

assert_docs
2 changes: 2 additions & 0 deletions ansible-elasticbeats/inventory/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[debops_service_elasticbeats]
placeholder_fqdn
12 changes: 12 additions & 0 deletions ansible-elasticbeats/playbooks/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---

- name: Manage Elastic Beats data shippers
hosts: [ 'debops_service_elasticbeats' ]
become: True

environment: '{{ inventory__environment | d({})
| combine(inventory__group_environment | d({}))
| combine(inventory__host_environment | d({})) }}'

roles:
- role: ansible-elasticbeats
28 changes: 28 additions & 0 deletions ansible-elasticbeats/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# test: Test debops.elasticbeats
# Copyright (C) 2014 Nick Janetakis <[email protected]>
# Part of the DebOps project - http://debops.org/


. "${ROLESPEC_LIB}/main"
. "${ROLESPEC_TEST}/../defaults.conf"


install_ansible stable-2.1
ansible_plugins


assert_playbook_check_runs
assert_playbook_idempotent


assert_path "/etc/filebeat/filebeat.yml"
assert_running filebeat
assert_path "/etc/topbeat/topbeat.yml"
assert_running topbeat
assert_path "/etc/packetbeat/packetbeat.yml"
assert_running packetbeat


assert_docs
1 change: 1 addition & 0 deletions ansible-elasticsearch/inventory/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---

elasticsearch__distribution_repository: False
elasticsearch_bind_host: ['0.0.0.0']
elasticsearch_node_allow: ['127.0.0.1']
elasticsearch_http_allow: ['127.0.0.1']
1 change: 1 addition & 0 deletions ansible-fail2ban/test
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ assert_playbook_idempotent
assert_path "/etc/fail2ban/jail.local"
assert_running "fail2ban-server"
assert_in_file "/etc/fail2ban/jail.local" "banaction"
assert_exit_code "sudo fail2ban-client -vv status ssh" "0"
assert_docs

4 changes: 4 additions & 0 deletions ansible-gdnsd/inventory/group_vars/all/gdnsd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

# Startup fails if service is bound to all available addresses in Travis-CI
gdnsd__listen: [ '{{ ansible_default_ipv4.address }}', '127.0.0.1' ]
1 change: 1 addition & 0 deletions ansible-gdnsd/inventory/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
placeholder_fqdn
7 changes: 7 additions & 0 deletions ansible-gdnsd/playbooks/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

- hosts: 'placeholder_fqdn'
become: True

roles:
- role: 'ansible-gdnsd'
33 changes: 33 additions & 0 deletions ansible-gdnsd/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# test: Test debops.apt
# Copyright (C) 2014 Nick Janetakis <[email protected]>
# Part of the DebOps project - http://debops.org/


. "${ROLESPEC_LIB}/main"
. "${ROLESPEC_TEST}/../defaults.conf"

# Prevent auto-start of unconfigured service
cat <<EOF | sudo tee /usr/sbin/policy-rc.d
#!/bin/sh
echo "All runlevel operations denied by policy" >&2
exit 101
EOF
sudo chmod +x /usr/sbin/policy-rc.d

install_ansible ${test_ansible_version}
ansible_plugins

assert_playbook_check_runs
assert_playbook_idempotent

assert_path /etc/gdnsd/config
assert_running gdnsd
assert_in "$(dig @127.0.0.1 localdomain SOA)" "${HOSTNAME}.localdomain."
assert_in "$(dig @127.0.0.1 localdomain NS)" "${HOSTNAME}.localdomain."
assert_in "$(dig @127.0.0.1 ${HOSTNAME}.localdomain)" "86400"
addr="$(dig @127.0.0.1 +short ${HOSTNAME}.localdomain)"
assert_in "$(dig @127.0.0.1 -x ${addr})" "${HOSTNAME}.localdomain."

assert_docs
2 changes: 2 additions & 0 deletions ansible-kibana/inventory/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[debops_service_kibana]
placeholder_fqdn
17 changes: 17 additions & 0 deletions ansible-kibana/playbooks/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---

- name: Manage Kibana analytics and visualization platform
hosts: [ 'debops_service_kibana' ]
become: True

environment: '{{ inventory__environment | d({})
| combine(inventory__group_environment | d({}))
| combine(inventory__host_environment | d({})) }}'

roles:

- role: debops.ferm
ferm__dependent_rules:
- '{{ kibana__ferm__dependent_rules }}'

- role: ansible-kibana
25 changes: 25 additions & 0 deletions ansible-kibana/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# test: Test debops.kibana
# Copyright (C) 2014 Nick Janetakis <[email protected]>
# Part of the DebOps project - http://debops.org/


. "${ROLESPEC_LIB}/main"
. "${ROLESPEC_TEST}/../defaults.conf"


install_ansible ${test_ansible_version}
ansible_plugins

ansible-galaxy -f install debops.ferm


assert_playbook_check_runs
assert_playbook_idempotent

assert_iptables_allow 5601
assert_path "/etc/kibana/kibana.yml"
assert_tcp localhost 5601

assert_docs
1 change: 1 addition & 0 deletions ansible-roundcube/inventory/group_vars/all/common
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

roundcube_domain: [ 'localhost.localdomain' ]

1 change: 1 addition & 0 deletions ansible-roundcube/inventory/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
placeholder_fqdn
25 changes: 25 additions & 0 deletions ansible-roundcube/playbooks/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---

- hosts: 'placeholder_fqdn'
become: True

environment: '{{ inventory__environment | d({})
| combine(inventory__group_environment | d({}))
| combine(inventory__host_environment | d({})) }}'

roles:

- role: debops.php5
php5_packages:
- '{{ roundcube__php5_packages }}'
php5_pools:
- '{{ roundcube__php5_pool }}'

- role: debops.nginx
nginx_servers:
- '{{ roundcube__nginx_server }}'
nginx_upstreams:
- '{{ roundcube__nginx_upstream_php5 }}'

- role: 'ansible-roundcube'

32 changes: 32 additions & 0 deletions ansible-roundcube/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# test: Test debops.owncloud
# Copyright (C) 2014 Nick Janetakis <[email protected]>
# Part of the DebOps project - http://debops.org/


. "${ROLESPEC_LIB}/main"
. "${ROLESPEC_TEST}/../defaults.conf"


install_ansible ${test_ansible_version}
ansible_plugins


ansible-galaxy -f install debops.php5
ansible-galaxy -f install debops.nginx


# Use Trusty packages for more recent PHP5 support
echo "deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/trusty.list
sudo apt-get -qq update


assert_playbook_check_runs
assert_playbook_idempotent


assert_path "/srv/www/roundcube"

assert_docs