WIP: Show free disk scace for SBs

This commit is contained in:
phil 2023-11-01 15:36:50 +01:00
parent 063e4f7734
commit c246a86a25
3 changed files with 31 additions and 7 deletions

View file

@ -10,13 +10,6 @@
tags: facts
when: inventory_hostname not in groups.storage_boxes
- name: Set facts for storage storage boxes
ansible.builtin.set_fact:
ansible_date_time:
date: "{{ '%Y-%m-%d' | strftime }}"
time: "{{ '%H:%M:%S' | strftime }}"
when: inventory_hostname in groups.storage_boxes
- name: Create hypervisor items
ansible.builtin.import_tasks: hypervisor.yml
when:
@ -26,6 +19,11 @@
- hypervisor
- server
- name: Gather storage box facts
ansible.builtin.import_tasks: storage_box.yml
tags: storage_box
when: inventory_hostname in groups.storage_boxes
- name: Create server items
ansible.builtin.import_tasks: server.yml
delegate_to: "{{ cmdb.wiki_server }}"

24
tasks/storage_box.yml Normal file
View file

@ -0,0 +1,24 @@
---
- name: "Storage Box | Set facts for storage storage boxes"
ansible.builtin.set_fact:
ansible_date_time:
date: "{{ '%Y-%m-%d' | strftime }}"
time: "{{ '%H:%M:%S' | strftime }}"
- name: "Storage Box | Scrap free space"
ansible.builtin.command: "df -h"
register: command_out
changed_when: false
- name: "Storage Box | Set VM fact"
ansible.builtin.set_fact:
sb_space: "{{ command_out.stdout }}"
- name: "Storage Box | Write Storage Box startpage"
ansible.builtin.template:
src: storage_boxes.txt.j2
dest: "{{ cmdb.wiki_pages_path }}/servers/storage_boxes.txt"
owner: "{{ cmdb.wiki_user }}"
group: "{{ cmdb.wiki_group }}"
mode: "0644"
delegate_to: "{{ cmdb.wiki_server }}"

View file

@ -2,3 +2,5 @@
* {{ ansible_host }}:{{ ansible_port }}
* {{ ansible_user }}
{{ sb_space }}