dns_resolver_conf/molecule/with_custom_config_vagrant/verify.yml

31 lines
1.2 KiB
YAML
Raw Normal View History

---
- name: Verify
hosts: all
gather_facts: true
2023-12-03 16:03:05 +00:00
become: true
tasks:
- 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)"