manage_netplan/molecule/with_custom_config/verify.yml
Bertrand Lanson 30ce327d55
All checks were successful
test / Linting (push) Successful in 18s
test / Molecule tests (default, debian11) (push) Successful in 47s
test / Molecule tests (default, debian12) (push) Successful in 53s
test / Molecule tests (default, ubuntu2204) (push) Successful in 49s
test / Molecule tests (default, ubuntu2004) (push) Successful in 1m21s
test / Molecule tests (with_custom_config, debian11) (push) Successful in 45s
test / Molecule tests (with_custom_config, debian12) (push) Successful in 49s
test / Molecule tests (with_custom_config, ubuntu2004) (push) Successful in 51s
test / Molecule tests (with_custom_config, ubuntu2204) (push) Successful in 46s
feat: remove become from role
2023-12-03 17:48:46 +01:00

53 lines
1.8 KiB
YAML

---
- name: Verify
hosts: all
gather_facts: true
become: 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"
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 == 'root'
- name: "Test: directory /tmp"
block:
- name: "Stat directory /etc/netplan"
ansible.builtin.stat:
path: "/etc/netplan"
register: stat_etc_netplan
- name: "Stat file /tmp/ansible-config.yaml"
ansible.builtin.stat:
path: "/tmp/ansible-config.yaml"
register: stat_tmp_ansible_config_yml
- name: "Slurp file /tmp/ansible-config.yaml"
ansible.builtin.slurp:
src: "/tmp/ansible-config.yaml"
register: slurp_tmp_ansible_config_yml
- name: "Verify directory /tmp/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_tmp_ansible_config_yml.stat.exists
- stat_tmp_ansible_config_yml.stat.isreg
- stat_tmp_ansible_config_yml.stat.pw_name == 'root'
- stat_tmp_ansible_config_yml.stat.gr_name == 'root'
- stat_tmp_ansible_config_yml.stat.mode == '0644'
- slurp_tmp_ansible_config_yml.content != ''