manage_apt_packages/molecule/with_custom_packages/verify.yml

35 lines
1.2 KiB
YAML
Raw Normal View History

---
- name: Verify
hosts: all
2023-12-03 16:45:22 +00:00
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: packages mariadb-server, apache2, consul:1.13.1-1"
block:
- name: "Get packages facts"
ansible.builtin.package_facts:
manager: auto
- name: "Verify packages mariadb-server, apache2, consul:1.13.1-1"
ansible.builtin.assert:
that:
2023-06-30 21:46:04 +00:00
- "ansible_facts.packages['mariadb-server'][0]['name'] == 'mariadb-server'"
- "ansible_facts.packages['apache2'][0]['name'] == 'apache2'"
- "ansible_facts.packages['consul'][0]['name'] == 'consul'"
- "ansible_facts.packages['consul'][0]['version'] == '1.13.1-1'"