Compare commits
1 Commits
fix/molecu
...
cb20db00af
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb20db00af |
31
.github/skills/molecule-role-testing/SKILL.md
vendored
31
.github/skills/molecule-role-testing/SKILL.md
vendored
@@ -1,31 +0,0 @@
|
|||||||
---
|
|
||||||
name: molecule-role-testing
|
|
||||||
description: Run Molecule scenarios to test the bind9 role using the repository's Molecule configuration.
|
|
||||||
---
|
|
||||||
|
|
||||||
Use this skill when asked to test or validate the role with Molecule.
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
- Repository root: /home/alive/Code/ansible-bind9-role
|
|
||||||
- Scenarios: molecule/default and molecule/bind9-20
|
|
||||||
- Driver: podman
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
1. Ensure Podman is available and the current user can run it.
|
|
||||||
2. Ensure Molecule and Ansible are installed in the active Python environment.
|
|
||||||
|
|
||||||
## Default scenario (BIND 9.18 LTS)
|
|
||||||
1. From the repository root, run:
|
|
||||||
- molecule test
|
|
||||||
2. If a faster check is requested, run:
|
|
||||||
- molecule converge
|
|
||||||
|
|
||||||
## BIND 9.20+ scenario
|
|
||||||
1. From the repository root, run:
|
|
||||||
- molecule test -s bind9-20
|
|
||||||
2. If a faster check is requested, run:
|
|
||||||
- molecule converge -s bind9-20
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
- The scenarios use systemd-enabled containers and require privileged Podman.
|
|
||||||
- If a scenario fails, capture the error summary and relevant logs before making changes.
|
|
||||||
@@ -2,11 +2,18 @@
|
|||||||
- name: Converge
|
- name: Converge
|
||||||
hosts: all
|
hosts: all
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Create log directory for BIND
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /var/log/named
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
owner: bind
|
||||||
|
group: bind
|
||||||
|
|
||||||
- name: Include bind9 role
|
- name: Include bind9 role
|
||||||
ansible.builtin.include_role:
|
ansible.builtin.include_role:
|
||||||
name: ../../../ansible-bind9-role # noqa: role-name[path]
|
name: ../../../ansible-bind9-role # noqa: role-name[path]
|
||||||
vars:
|
vars:
|
||||||
bind9_log_dir: /var/log/named
|
|
||||||
bind9_backup_config: false
|
bind9_backup_config: false
|
||||||
bind9_host_config:
|
bind9_host_config:
|
||||||
- name: named.conf.options
|
- name: named.conf.options
|
||||||
@@ -106,14 +113,3 @@
|
|||||||
forwarders:
|
forwarders:
|
||||||
- 10.0.0.53
|
- 10.0.0.53
|
||||||
- 10.0.0.54
|
- 10.0.0.54
|
||||||
|
|
||||||
- name: Post-converge
|
|
||||||
hosts: all
|
|
||||||
tasks:
|
|
||||||
- name: Create log directory for BIND
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: /var/log/named
|
|
||||||
state: directory
|
|
||||||
mode: '0750'
|
|
||||||
owner: bind
|
|
||||||
group: bind
|
|
||||||
|
|||||||
@@ -41,8 +41,7 @@
|
|||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "'forwarders' in __options_decoded"
|
- "'forwarders' in __options_decoded"
|
||||||
- "'91.239.100.100' in __options_decoded"
|
- "'8.8.8.8' in __options_decoded"
|
||||||
- "'89.233.43.71' in __options_decoded"
|
|
||||||
- "'forward first' in __options_decoded"
|
- "'forward first' in __options_decoded"
|
||||||
fail_msg: Forwarders not properly configured in named.conf.options
|
fail_msg: Forwarders not properly configured in named.conf.options
|
||||||
vars:
|
vars:
|
||||||
|
|||||||
@@ -18,17 +18,6 @@
|
|||||||
mode: "0750"
|
mode: "0750"
|
||||||
when: bind9_backup_config is defined and bind9_backup_config | bool
|
when: bind9_backup_config is defined and bind9_backup_config | bool
|
||||||
|
|
||||||
- name: Ensure logging directory exists if defined
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ bind9_log_dir }}"
|
|
||||||
state: directory
|
|
||||||
owner: bind
|
|
||||||
group: bind
|
|
||||||
mode: "0750"
|
|
||||||
when:
|
|
||||||
- bind9_log_dir is defined
|
|
||||||
- bind9_log_dir is not none
|
|
||||||
|
|
||||||
- name: Deploy and Validate Configuration
|
- name: Deploy and Validate Configuration
|
||||||
tags:
|
tags:
|
||||||
- bind9
|
- bind9
|
||||||
@@ -45,7 +34,6 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: bind
|
group: bind
|
||||||
mode: "0640"
|
mode: "0640"
|
||||||
when: bind9_backup_config | bool
|
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false # It's okay if the file doesn't exist yet
|
failed_when: false # It's okay if the file doesn't exist yet
|
||||||
loop: "{{ bind9_config }}"
|
loop: "{{ bind9_config }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user