dns_resolver_conf/molecule/with_custom_config_vagrant/verify.yml
Bertrand Lanson 927d07e01b
All checks were successful
test / Linting (push) Successful in 17s
test / Molecule tests (default, debian11) (push) Successful in 31s
test / Molecule tests (default, debian12) (push) Successful in 30s
test / Molecule tests (default, ubuntu2004) (push) Successful in 37s
test / Molecule tests (default, ubuntu2204) (push) Successful in 32s
test / Molecule tests (with_custom_config, debian11) (push) Successful in 31s
test / Molecule tests (with_custom_config, debian12) (push) Successful in 30s
test / Molecule tests (with_custom_config, ubuntu2204) (push) Successful in 32s
test / Molecule tests (with_custom_config, ubuntu2004) (push) Successful in 37s
feat: remove become from role
2023-12-03 17:03:05 +01:00

50 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"
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: file /tmp/resolv.conf"
block:
- name: "Stat file /tmp/resolv.conf"
ansible.builtin.stat:
path: "/tmp/resolv.conf"
register: stat_tmp_resolv_conf
- name: "Slurp file /tmp/resolv.conf"
ansible.builtin.slurp:
src: "/tmp/resolv.conf"
register: slurp_tmp_resolv_conf
- name: "Verify file /tmp/resolv.conf"
ansible.builtin.assert:
that:
- stat_tmp_resolv_conf.stat.exists
- stat_tmp_resolv_conf.stat.isreg
- stat_tmp_resolv_conf.stat.pw_name == 'root'
- stat_tmp_resolv_conf.stat.gr_name == 'root'
- stat_tmp_resolv_conf.stat.mode == '0644'
- "'search example.org az1.example.org' in (slurp_tmp_resolv_conf.content|b64decode)"
- "'nameserver 10.1.20.53' in (slurp_tmp_resolv_conf.content|b64decode)"
- "'nameserver 10.1.20.54' in (slurp_tmp_resolv_conf.content|b64decode)"
- "'options edns0 rotate' in (slurp_tmp_resolv_conf.content|b64decode)"