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

@@ -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