Initial Commit

This commit is contained in:
2020-10-13 16:33:32 +13:00
commit d646952ef5
23 changed files with 429 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
*******
Docker driver installation guide
*******
Requirements
============
* Docker Engine
Install
=======
Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
.. code-block:: bash
$ python3 -m pip install 'molecule[docker]'

View File

@@ -0,0 +1,30 @@
---
- name: Cleanup
hosts: localhost
gather_facts: false
become: no
vars:
cmk_rpm_agent: "{{ lookup('env', 'CMK_RPM_AGENT') }}"
cmk_omd_host: "{{ lookup('env', 'CMK_OMD_HOST') }}"
cmk_omd_site: "{{ lookup('env', 'CMK_OMD_SITE') }}"
cmk_username: "{{ lookup('env', 'CMK_USERNAME') }}"
cmk_secret: "{{ lookup('env', 'CMK_SECRET') }}"
cmk_auth: "&_username={{ cmk_username }}&_secret={{ cmk_secret }}"
tasks:
- name: Delete Host
uri:
method: POST
url: http://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/webapi.py?action=delete_host{{ cmk_auth }}
body: 'request={"hostname":"{{ item.name }}"}'
body_format: raw
status_code: 200
no_log: true
with_items: "{{ molecule_yml.platforms }}"
- name: cmk_apply
uri:
method: POST
url: http://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/webapi.py?action=activate_changes&mode=specific{{ cmk_auth }}
body: 'request={"sites":["{{ cmk_omd_site }}"]}'
body_format: raw
status_code: 200

View File

@@ -0,0 +1,14 @@
---
- name: Converge
hosts: all
vars:
cmk_rpm_agent: "{{ lookup('env', 'CMK_RPM_AGENT') }}"
cmk_add_host: "{{ lookup('env', 'CMK_ADD_HOST') | bool }}"
cmk_omd_host: "{{ lookup('env', 'CMK_OMD_HOST') }}"
cmk_omd_site: "{{ lookup('env', 'CMK_OMD_SITE') }}"
cmk_username: "{{ lookup('env', 'CMK_USERNAME') }}"
cmk_secret: "{{ lookup('env', 'CMK_SECRET') }}"
tasks:
- name: "Include ansible-role-cmk-agent"
include_role:
name: "ansible-role-cmk-agent"

View File

@@ -0,0 +1,30 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: rhel8
image: docker.io/pycontribs/centos:8
privileged: True
volume_mounts:
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
command: "/usr/sbin/init"
pre_build_image: true
- name: rhel7
image: docker.io/pycontribs/centos:7
dockerfile: Centos7-Dockerfile
privileged: True
volume_mounts:
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
command: "/usr/sbin/init"
pre_build_image: false
provisioner:
name: ansible
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint
flake8

View File

@@ -0,0 +1,23 @@
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
pre_tasks:
- name: Gather facts of packages
package_facts:
manager: "auto"
- name: Populate service facts
service_facts:
tasks:
- name: check-mk-agent is installed
assert:
that: "'check-mk-agent' in ansible_facts.packages"
quiet: true
- name: xinetd is running and enabled
assert:
that:
- ansible_facts.services["xinetd.service"].state == "running"
- ansible_facts.services["xinetd.service"].status == "enabled"
quiet: true