From dae5abed61cf7863c412a163ffabfe080586b1c8 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Wed, 18 Sep 2019 12:38:25 +0200 Subject: [PATCH] Added playbook to store facts of hosts --- playbooks/store-facts.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 playbooks/store-facts.yml diff --git a/playbooks/store-facts.yml b/playbooks/store-facts.yml new file mode 100644 index 0000000..bef0844 --- /dev/null +++ b/playbooks/store-facts.yml @@ -0,0 +1,22 @@ +--- + +- name: Store facts of hosts + hosts: all + gather_facts: yes + tasks: + - name: Create directory for facts + file: + state: directory + path: "./facts" + owner: zocker + group: zocker + mode: "u=rwx,g=rx,o=rx" + delegate_to: localhost + - name: Download facts to file + copy: + content: "{{ ansible_facts | to_nice_yaml(indent=2) }}" + dest: "./facts/{{ ansible_fqdn }}.yml" + owner: zocker + group: zocker + mode: "u=rw,g=r,o=r" + delegate_to: localhost