manage_netplan/molecule/default_vagrant/verify.yml
Bertrand Lanson 3967974270
Some checks failed
test / Linting (push) Failing after 10s
test / Molecule tests (default, debian11) (push) Has been skipped
test / Molecule tests (default, debian12) (push) Has been skipped
test / Molecule tests (default, ubuntu2004) (push) Has been skipped
test / Molecule tests (default, ubuntu2204) (push) Has been skipped
test / Molecule tests (with_custom_config, debian11) (push) Has been skipped
test / Molecule tests (with_custom_config, debian12) (push) Has been skipped
test / Molecule tests (with_custom_config, ubuntu2004) (push) Has been skipped
test / Molecule tests (with_custom_config, ubuntu2204) (push) Has been skipped
feat: add vagrant tests for later, add become: true to some tasks to not rely on ansible.cfg
2023-11-29 22:49:57 +01:00

56 lines
2.0 KiB
YAML

---
- name: Verify
hosts: all
gather_facts: true
tasks:
- name: "Test: file /etc/hosts"
block:
- name: "Stat file /etc/hosts"
ansible.builtin.stat:
path: "/etc/hosts"
register: stat_etc_hosts
- name: "Verify file /etc/hosts"
vars:
etc_hosts_group:
ubuntu: "adm"
debian: "root"
ansible.builtin.assert:
that:
- stat_etc_hosts.stat.exists
- stat_etc_hosts.stat.isreg
- stat_etc_hosts.stat.pw_name == 'root'
- stat_etc_hosts.stat.gr_name == etc_hosts_group[(ansible_distribution|lower)]
- name: "Test: directory /etc/netplan"
block:
- name: "Stat directory /etc/netplan"
ansible.builtin.stat:
path: "/etc/netplan"
register: stat_etc_netplan
- name: "Stat file /etc/netplan/ansible-config.yaml"
ansible.builtin.stat:
path: "/etc/netplan/ansible-config.yaml"
register: stat_etc_netplan_ansible_config_yml
- name: "Slurp file /etc/netplan/ansible-config.yaml"
ansible.builtin.slurp:
src: "/etc/netplan/ansible-config.yaml"
register: slurp_etc_netplan_ansible_config_yml
- name: "Verify directory /etc/netplan"
ansible.builtin.assert:
that:
- stat_etc_netplan.stat.exists
- stat_etc_netplan.stat.isdir
- stat_etc_netplan.stat.pw_name == 'root'
- stat_etc_netplan.stat.gr_name == 'root'
- stat_etc_netplan.stat.mode == '0755'
- stat_etc_netplan_ansible_config_yml.stat.exists
- stat_etc_netplan_ansible_config_yml.stat.isreg
- stat_etc_netplan_ansible_config_yml.stat.pw_name == 'root'
- stat_etc_netplan_ansible_config_yml.stat.gr_name == 'root'
- stat_etc_netplan_ansible_config_yml.stat.mode == '0644'
- slurp_etc_netplan_ansible_config_yml.content != ''