ansible-infra/check.yaml
June abc738c9c2
All checks were successful
/ Ansible Lint (push) Successful in 1m33s
flatten the "playbooks" directory for better structure
Because of how Ansible local relative search paths work, the global
"files" and "templates" directories need to be next to the playbooks.
However its not intuitive to look into the playbooks directory to find
the files and templates for a host.
Therefore flatten the playbooks directory to get rid of this confusing
structure.

Also see:
https://docs.ansible.com/ansible/latest/playbook_guide/playbook_pathing.html#resolving-local-relative-paths
2024-12-02 00:48:19 +01:00

31 lines
947 B
YAML

---
- name: Host information
hosts: all
tasks:
- name: Print OS distribution and version
ansible.builtin.debug:
msg: "{{ ansible_facts['distribution'] }} {{ ansible_facts['distribution_version'] }} ({{ ansible_facts['distribution_release'] }})"
- name: Find all .dpkg-* files
ansible.builtin.find:
paths: /etc
file_type: file
recurse: true
use_regex: false
patterns:
- "*.dpkg-*"
become: true
register: check__dpkg_files
- name: Create variable for list of all .dpkg-* files
ansible.builtin.set_fact:
check__dpkg_files_list: [ ]
- name: Populate list of all .dpkg-* files
ansible.builtin.set_fact:
check__dpkg_files_list: "{{ check__dpkg_files_list + [item.path] }}"
loop: "{{ check__dpkg_files.files }}"
- name: Print .dpkg-* files list
ansible.builtin.debug:
var: check__dpkg_files_list