update_motd/molecule/default/verify.yml

29 lines
1.1 KiB
YAML
Raw Normal View History

2023-07-19 21:11:53 +00:00
---
- name: Verify
hosts: all
2023-07-20 21:53:09 +00:00
gather_facts: true
2023-12-03 17:26:11 +00:00
become: true
2023-07-19 21:11:53 +00:00
tasks:
2023-07-20 21:53:09 +00:00
- name: "Test: file /etc/profile.d/motd.cfg"
block:
- name: "Stat file /etc/profile.d/motd.cfg"
ansible.builtin.stat:
path: "/etc/profile.d/motd.cfg"
register: stat_etc_profile_d_motd_cfg
- name: "Slurp file /etc/profile.d/motd.cfg"
ansible.builtin.slurp:
src: "/etc/profile.d/motd.cfg"
register: slurp_etc_profile_d_motd_cfg
- name: "Verify file /etc/profile.d/motd.cfg"
ansible.builtin.assert:
that:
- stat_etc_profile_d_motd_cfg.stat.exists
- stat_etc_profile_d_motd_cfg.stat.isreg
- stat_etc_profile_d_motd_cfg.stat.pw_name == 'root'
- stat_etc_profile_d_motd_cfg.stat.gr_name == 'root'
- stat_etc_profile_d_motd_cfg.stat.mode == '0644'
- "'print_info()' in (slurp_etc_profile_d_motd_cfg.content|b64decode)"
- "'ascii_distro=\"auto\"' in (slurp_etc_profile_d_motd_cfg.content|b64decode)"