Proper role testing

This commit is contained in:
2022-08-11 00:07:24 +12:00
parent 1efc90e172
commit 841bfc2eec
8 changed files with 36 additions and 15 deletions

View File

@@ -61,3 +61,5 @@ cmk_force_install: false
cmk_host_ip: "{{ ansible_host }}"
cmk_dl_needs_auth: true
cmk_debug: True

View File

@@ -1,7 +1,8 @@
galaxy_info:
author: Aaron Guise
description: Install checkmk agent with Enterprise Baked Agent
role_name: check_mk_agent
namespace: cybercinch
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

View File

@@ -14,17 +14,17 @@
- name: Delete Host
uri:
method: POST
url: http://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/webapi.py?action=delete_host{{ cmk_auth }}
url: https://{{ 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
no_log: False
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 }}
url: https://{{ 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

@@ -8,7 +8,11 @@
cmk_omd_site: "{{ lookup('env', 'CMK_OMD_SITE') }}"
cmk_username: "{{ lookup('env', 'CMK_USERNAME') }}"
cmk_secret: "{{ lookup('env', 'CMK_SECRET') }}"
cmk_download_mode: "{{ lookup('env', 'CMK_DOWNLOAD_MODE') }}"
cmk_download_path: "{{ lookup('env', 'CMK_DOWNLOAD_PATH') }}"
cmk_smb_username: "{{ lookup('env', 'CMK_SMB_USERNAME') }}"
cmk_smb_password: "{{ lookup('env', 'CMK_SMB_PASSWORD') }}"
tasks:
- name: "Include ansible-role-cmk-agent"
include_role:
name: "ansible-role-cmk-agent"
name: "ansi-ansible-role-check-mk-agent"

View File

@@ -5,27 +5,30 @@ driver:
name: docker
platforms:
- name: rhel8
image: guisea/centos8-ansible:latest
image: docker.io/cybercinch/docker-almalinux8-ansible
# dockerfile: Centos8-Dockerfile
privileged: True
volume_mounts:
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
command: "/usr/sbin/init"
command: ${MOLECULE_DOCKER_COMMAND:-"/usr/sbin/init"}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
pre_build_image: true
- name: rhel7
image: guisea/centos7-ansible:latest
# dockerfile: Centos7-Dockerfile
privileged: True
volume_mounts:
volumes:
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
command: "/usr/sbin/init"
pre_build_image: true
provisioner:
name: ansible
log: True
options:
vvv: True
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint
flake8
# lint: |
# set -e
# yamllint .
# ansible-lint
# flake8

View File

@@ -6,6 +6,11 @@
state: present
notify: restart xinetd
- name: Ensure python openssl available
package:
name: python3-openssl,python3-requests
state: present
- name: Fix SeLinux Auto-Updates
block:
- name: list installed selinux modules

View File

@@ -6,6 +6,11 @@
state: present
notify: restart xinetd
- name: Start xinetd
service:
name: xinetd
state: started
- name: Fix SeLinux Auto-Updates
block:
- name: list installed selinux modules

View File

@@ -8,6 +8,7 @@
package:
name: "{{ item }}"
state: present
become: True
with_items:
- samba-client
- cifs-utils