2023-07-08 20:59:36 +00:00
|
|
|
---
|
|
|
|
- name: Verify
|
|
|
|
hosts: all
|
2023-12-03 16:48:46 +00:00
|
|
|
gather_facts: true
|
|
|
|
become: true
|
2023-07-08 20:59:36 +00:00
|
|
|
tasks:
|
|
|
|
- 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 != ''
|