Bertrand Lanson
652d621187
Some checks are pending
test / Linting (push) Waiting to run
test / Molecule tests (default, debian11) (push) Blocked by required conditions
test / Molecule tests (default, debian12) (push) Blocked by required conditions
test / Molecule tests (default, ubuntu2004) (push) Blocked by required conditions
test / Molecule tests (default, ubuntu2204) (push) Blocked by required conditions
test / Molecule tests (with_ssh_keys, debian11) (push) Blocked by required conditions
test / Molecule tests (with_ssh_keys, debian12) (push) Blocked by required conditions
test / Molecule tests (with_ssh_keys, ubuntu2004) (push) Blocked by required conditions
test / Molecule tests (with_ssh_keys, ubuntu2204) (push) Blocked by required conditions
54 lines
1.9 KiB
YAML
54 lines
1.9 KiB
YAML
---
|
|
- name: Verify
|
|
hosts: all
|
|
gather_facts: true
|
|
become: true
|
|
tasks:
|
|
- name: "Test: ansible user and group"
|
|
block:
|
|
- name: "Getent user ansible"
|
|
ansible.builtin.getent:
|
|
database: passwd
|
|
key: ansible
|
|
register: ednz_cloud_ansible_user
|
|
|
|
- name: "Getent group ansible"
|
|
ansible.builtin.getent:
|
|
database: group
|
|
key: ansible
|
|
register: ednz_cloud_ansible_group
|
|
|
|
- name: "Verify ansible user and group"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- not ednz_cloud_ansible_user.failed
|
|
- not ednz_cloud_ansible_group.failed
|
|
- "'ansible' in ednz_cloud_ansible_user.ansible_facts.getent_passwd.keys()"
|
|
- "'/opt/ansible' in ednz_cloud_ansible_user.ansible_facts.getent_passwd['ansible']"
|
|
- "'/bin/bash' in ednz_cloud_ansible_user.ansible_facts.getent_passwd['ansible']"
|
|
- "'ansible' in ednz_cloud_ansible_group.ansible_facts.getent_group.keys()"
|
|
|
|
- name: "Test: ansible sudo permissions"
|
|
block:
|
|
- name: "Stat file /etc/sudoers.d/ansible"
|
|
ansible.builtin.stat:
|
|
path: "/etc/sudoers.d/ansible"
|
|
register: stat_etc_sudoers_d_ansible
|
|
|
|
- name: "Verify file /etc/sudoers.d/ansible"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- not stat_etc_sudoers_d_ansible.stat.exists
|
|
|
|
- name: "Test: ansible authorized_keys"
|
|
block:
|
|
- name: "Stat file /opt/ansible/.ssh/authorized_keys"
|
|
ansible.builtin.stat:
|
|
path: "/opt/ansible/.ssh/authorized_keys"
|
|
register: stat_opt_ansible_ssh_authorized_keys
|
|
|
|
- name: "Verify file /opt/ansible/.ssh/authorized_keys"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- not stat_opt_ansible_ssh_authorized_keys.stat.exists
|