Bertrand Lanson
0b0fc6673e
All checks were successful
test / Linting (push) Successful in 39s
test / Molecule tests (default, debian12) (push) Successful in 58s
test / Molecule tests (default, debian11) (push) Successful in 1m22s
test / Molecule tests (default, ubuntu2004) (push) Successful in 59s
test / Molecule tests (default, ubuntu2204) (push) Successful in 58s
test / Molecule tests (with_extra_sidecars, debian11) (push) Successful in 53s
test / Molecule tests (with_extra_sidecars, debian12) (push) Successful in 1m6s
test / Molecule tests (with_extra_sidecars, ubuntu2004) (push) Successful in 39s
test / Molecule tests (with_extra_sidecars, ubuntu2204) (push) Successful in 33s
99 lines
4.5 KiB
YAML
99 lines
4.5 KiB
YAML
---
|
|
- name: Verify
|
|
hosts: all
|
|
gather_facts: false
|
|
become: true
|
|
tasks:
|
|
- name: "Test: directory /opt/adguard"
|
|
block:
|
|
- name: "Stat directory /opt/adguard"
|
|
ansible.builtin.stat:
|
|
path: "/opt/adguard"
|
|
register: stat_opt_adguard
|
|
|
|
- name: "Stat directory /opt/adguard/conf"
|
|
ansible.builtin.stat:
|
|
path: "/opt/adguard/conf"
|
|
register: stat_opt_adguard_conf
|
|
|
|
- name: "Stat directory /opt/adguard/data"
|
|
ansible.builtin.stat:
|
|
path: "/opt/adguard/data"
|
|
register: stat_opt_adguard_data
|
|
|
|
- name: "Verify directory /etc/consul.d"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- stat_opt_adguard.stat.exists
|
|
- stat_opt_adguard.stat.isdir
|
|
- stat_opt_adguard.stat.pw_name == 'root'
|
|
- stat_opt_adguard.stat.gr_name == 'root'
|
|
- stat_opt_adguard.stat.mode == '0755'
|
|
- stat_opt_adguard_conf.stat.exists
|
|
- stat_opt_adguard_conf.stat.isdir
|
|
- stat_opt_adguard_conf.stat.pw_name == 'root'
|
|
- stat_opt_adguard_conf.stat.gr_name == 'root'
|
|
- stat_opt_adguard_conf.stat.mode == '0755'
|
|
- stat_opt_adguard_data.stat.exists
|
|
- stat_opt_adguard_data.stat.isdir
|
|
- stat_opt_adguard_data.stat.pw_name == 'root'
|
|
- stat_opt_adguard_data.stat.gr_name == 'root'
|
|
- stat_opt_adguard_data.stat.mode == '0755'
|
|
|
|
- name: "Test: service adguard"
|
|
block:
|
|
- name: "Get service adguard"
|
|
ansible.builtin.service_facts:
|
|
|
|
- name: "Stat file /etc/systemd/system/adguard.service"
|
|
ansible.builtin.stat:
|
|
path: "/etc/systemd/system/adguard.service"
|
|
register: stat_etc_systemd_system_adguard_service
|
|
|
|
- name: "Slurp file /etc/systemd/system/adguard.service"
|
|
ansible.builtin.slurp:
|
|
src: "/etc/systemd/system/adguard.service"
|
|
register: slurp_etc_systemd_system_adguard_service
|
|
|
|
- name: "Verify service adguard"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- stat_etc_systemd_system_adguard_service.stat.exists
|
|
- stat_etc_systemd_system_adguard_service.stat.isreg
|
|
- stat_etc_systemd_system_adguard_service.stat.pw_name == 'root'
|
|
- stat_etc_systemd_system_adguard_service.stat.gr_name == 'root'
|
|
- stat_etc_systemd_system_adguard_service.stat.mode == '0644'
|
|
- slurp_etc_systemd_system_adguard_service.content != ''
|
|
- ansible_facts.services['adguard.service'] is defined
|
|
- ansible_facts.services['adguard.service']['source'] == 'systemd'
|
|
- ansible_facts.services['adguard.service']['state'] == 'stopped'
|
|
- ansible_facts.services['adguard.service']['status'] == 'enabled'
|
|
|
|
- name: "Test: file /opt/adguard/docker-compose.yml"
|
|
block:
|
|
- name: "Slurp file /opt/adguard/docker-compose.yml"
|
|
ansible.builtin.slurp:
|
|
src: "/opt/adguard/docker-compose.yml"
|
|
register: slurp_opt_adguard_docker_compose_yml
|
|
|
|
- name: "Set fact for file content /opt/adguard/docker-compose.yml"
|
|
ansible.builtin.set_fact:
|
|
opt_adguard_docker_compose_yml_json: "{{ slurp_opt_adguard_docker_compose_yml.content | b64decode | from_yaml | to_json | from_json }}"
|
|
|
|
- name: "Verify file /opt/adguard/docker-compose.yml"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- opt_adguard_docker_compose_yml_json['version'] is defined
|
|
- opt_adguard_docker_compose_yml_json['version'] == '3.9'
|
|
- opt_adguard_docker_compose_yml_json['services'] is defined
|
|
- opt_adguard_docker_compose_yml_json['services']|length == 1
|
|
- opt_adguard_docker_compose_yml_json['services']['adguard'] is defined
|
|
- opt_adguard_docker_compose_yml_json['services']['adguard']['image'] == 'adguard/adguardhome:latest'
|
|
- opt_adguard_docker_compose_yml_json['networks'] is defined
|
|
- opt_adguard_docker_compose_yml_json['networks']|length == 1
|
|
- opt_adguard_docker_compose_yml_json['volumes'] is defined
|
|
- opt_adguard_docker_compose_yml_json['volumes']|length == 2
|
|
- opt_adguard_docker_compose_yml_json['volumes']['conf'] is defined
|
|
- opt_adguard_docker_compose_yml_json['volumes']['data'] is defined
|
|
- opt_adguard_docker_compose_yml_json['secrets'] is not defined
|