manage_repositories/molecule/default/verify.yml
Bertrand Lanson d12a59b6ab
All checks were successful
test / Linting (push) Successful in 25s
test / Molecule tests (default, debian11) (push) Successful in 1m0s
test / Molecule tests (default, debian12) (push) Successful in 1m1s
test / Molecule tests (default, ubuntu2004) (push) Successful in 1m10s
test / Molecule tests (with_custom_repo, debian11) (push) Successful in 1m6s
test / Molecule tests (default, ubuntu2204) (push) Successful in 1m11s
test / Molecule tests (with_custom_repo, debian12) (push) Successful in 1m6s
test / Molecule tests (with_custom_repo, ubuntu2204) (push) Successful in 43s
test / Molecule tests (with_custom_repo, ubuntu2004) (push) Successful in 1m3s
linting
2023-07-01 21:06:45 +02:00

59 lines
3.0 KiB
YAML

---
- name: Verify
hosts: all
gather_facts: 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: file /etc/apt/sources.list"
block:
- name: "Stat file /etc/apt/sources.list"
ansible.builtin.stat:
path: "/etc/apt/sources.list"
register: stat_etc_apt_sources_list
- name: "Slurp file /etc/apt/sources.list"
ansible.builtin.slurp:
src: "/etc/apt/sources.list"
register: slurp_etc_apt_sources_list
- name: "Verify file /etc/apt/sources.list"
ansible.builtin.assert:
that:
- stat_etc_apt_sources_list.stat.exists
- stat_etc_apt_sources_list.stat.isreg
- stat_etc_apt_sources_list.stat.pw_name == 'root'
- stat_etc_apt_sources_list.stat.gr_name == 'root'
- stat_etc_apt_sources_list.stat.mode == '0644'
- name: "Verify file /etc/apt/sources.list"
ansible.builtin.assert:
that:
- "('deb http://fr.archive.ubuntu.com/ubuntu ' + ansible_distribution_release + ' main restricted universe multiverse') in (slurp_etc_apt_sources_list.content|b64decode)"
- "('deb http://fr.archive.ubuntu.com/ubuntu ' + ansible_distribution_release + '-updates main restricted universe multiverse') in (slurp_etc_apt_sources_list.content|b64decode)"
- "('deb http://fr.archive.ubuntu.com/ubuntu ' + ansible_distribution_release + '-security main restricted universe multiverse') in (slurp_etc_apt_sources_list.content|b64decode)"
- "('deb http://fr.archive.ubuntu.com/ubuntu ' + ansible_distribution_release + '-backports main restricted universe multiverse') in (slurp_etc_apt_sources_list.content|b64decode)"
when: (ansible_distribution|lower) == 'ubuntu'
- name: "Verify file /etc/apt/sources.list"
ansible.builtin.assert:
that:
- "('deb http://deb.debian.org/debian ' + ansible_distribution_release + ' main contrib') in (slurp_etc_apt_sources_list.content|b64decode)"
- "('deb http://deb.debian.org/debian ' + ansible_distribution_release + '-updates main contrib') in (slurp_etc_apt_sources_list.content|b64decode)"
- "('deb http://deb.debian.org/debian-security ' + ansible_distribution_release + '-security main contrib') in (slurp_etc_apt_sources_list.content|b64decode)"
- "('deb http://deb.debian.org/debian ' + ansible_distribution_release + '-backports main') in (slurp_etc_apt_sources_list.content|b64decode)"
when: (ansible_distribution|lower) == 'debian'