diff --git a/inventory.production.ini b/inventory.production.ini index 597ec8c..1670986 100644 --- a/inventory.production.ini +++ b/inventory.production.ini @@ -1,10 +1,23 @@ # Declare all servers here with their configuration variables # Please sort it alphabetically -[all:vars] +[monitoring] +monitoring-01 ansible_ssh_host=34.1.5.157 + +[ovh] +ovh1 ansible_ssh_host=146.59.148.140 +ovh2 ansible_ssh_host=51.210.154.203 +ovh3 ansible_ssh_host=51.210.32.79 + +[free] +off1 ansible_ssh_host=213.36.253.206 +off2 ansible_ssh_host=213.36.253.208 + +# servers that are configured using this repository +[ops_installed:children] +monitoring + +[ops_installed:vars] ansible_ssh_user=debian host_domain=infra.openfoodfacts.org ansible_host='{{ inventory_hostname }}.{{ host_domain }}' - -[monitoring] -monitoring-01 ansible_ssh_host=34.1.5.157 diff --git a/jobs/configure.yml b/jobs/configure.yml index cdc7c91..c11eac9 100644 --- a/jobs/configure.yml +++ b/jobs/configure.yml @@ -1,6 +1,8 @@ --- - name: Common configuration - hosts: all + # limit to host that were configured using this role + hosts: + - ops_installed gather_facts: true become: true roles: diff --git a/jobs/reporting.yml b/jobs/reporting.yml new file mode 100644 index 0000000..9c49c87 --- /dev/null +++ b/jobs/reporting.yml @@ -0,0 +1,12 @@ +--- +# The goal of this job is to generate a reports +# of the current state of the servers +# than can either serve as documentation of the architecture +# or as a mean to check some requirements are met +# (like number of backups replications) +- name: Generate servers reports + hosts: all + gather_facts: true + become: true + roles: + - role: zfs_report diff --git a/roles/zfs_report/tasks/display_dataset.yml b/roles/zfs_report/tasks/display_dataset.yml new file mode 100644 index 0000000..214bd4f --- /dev/null +++ b/roles/zfs_report/tasks/display_dataset.yml @@ -0,0 +1,5 @@ +- ansible.builtin.debug: + msg: "{{ zpool_name }}" +- ansible.builtin.debug: + msg: "- {{ item.name }}" + loop: "{{ datasets }}" diff --git a/roles/zfs_report/tasks/main.yml b/roles/zfs_report/tasks/main.yml new file mode 100644 index 0000000..15ca8a4 --- /dev/null +++ b/roles/zfs_report/tasks/main.yml @@ -0,0 +1,22 @@ +- name: "Get all ZFS pools" + community.general.zpool_facts: + parsable: true + +- name: "Get all ZFS datasets" + community.general.zfs_facts: + name: "{{ item.name }}" + parsable: true + recurse: true + type: volume + with_items: "{{ ansible_zfs_pools }}" + register: zfs_data + +- ansible.builtin.include_tasks: + file: display_dataset.yml + apply: + vars: + datasets: "{{ zfs_data_item.ansible_facts.ansible_zfs_datasets }}" + zpool_name: "{{ zfs_data_item.name }}" + with_items: "{{ zfs_data.results }}" + loop_control: + loop_var: zfs_data_item