33 lines
828 B
YAML
33 lines
828 B
YAML
|
|
---
|
||
|
|
# Molecule verify playbook - runs tests to verify roles
|
||
|
|
|
||
|
|
- name: Verify
|
||
|
|
hosts: all
|
||
|
|
gather_facts: false
|
||
|
|
tasks:
|
||
|
|
- name: Check if base OS packages are installed
|
||
|
|
shell: dpkg -l | grep -E '(curl|wget|vim|htop)'
|
||
|
|
register: package_check
|
||
|
|
failed_when: package_check.rc not in [0, 1]
|
||
|
|
|
||
|
|
- name: Check SSH configuration
|
||
|
|
stat:
|
||
|
|
path: /etc/ssh/sshd_config
|
||
|
|
register: ssh_config_stat
|
||
|
|
failed_when: not ssh_config_stat.stat.exists
|
||
|
|
|
||
|
|
- name: Check firewall status
|
||
|
|
shell: ufw status | grep -q active
|
||
|
|
register: firewall_check
|
||
|
|
failed_when: false
|
||
|
|
|
||
|
|
- name: Verify admin user exists
|
||
|
|
getent:
|
||
|
|
database: passwd
|
||
|
|
key: infra-admin
|
||
|
|
failed_when: false
|
||
|
|
|
||
|
|
- name: Print verification results
|
||
|
|
debug:
|
||
|
|
msg: "Role verification completed"
|