manage_apt_packages/molecule/with_custom_packages/verify.yml

48 lines
1.5 KiB
YAML
Raw Normal View History

---
- name: Verify
hosts: all
gather_facts: false
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: package mariadb-server, apache2, consul:1.13.1-1"
block:
- name: "Command apt list mariadb-server"
ansible.builtin.command: "apt list mariadb-server"
changed_when: false
register: apt_list_mariadb_server
- name: "Command apt list apache2"
ansible.builtin.command: "apt list apache2"
changed_when: false
register: apt_list_apache2
- name: "Command apt list consul"
ansible.builtin.command: "apt-cache policy consul"
changed_when: false
register: apt_cache_policy_consul
- name: "Debug"
vars:
consul_yaml: "{{ (apt_cache_policy_consul.stdout|to_yaml|from_yaml) }}"
ansible.builtin.debug:
msg: "{{ consul_yaml|to_yaml }}"
- name: "Verify package vim"
ansible.builtin.assert:
that:
- "'[installed]' in apt_list_vim.stdout"