Merge pull request 'Add node_status role' (#7) from testing into main
Reviewed-on: #7
This commit is contained in:
commit
bae88f96a7
@ -1,2 +1,7 @@
|
|||||||
---
|
---
|
||||||
# defaults file for node_status
|
node_status_host : zg-lxut02.thezengarden.net
|
||||||
|
node_status_user : chris
|
||||||
|
node_status_group : chris
|
||||||
|
node_status_dir : /home/chris/node_status
|
||||||
|
node_status_file : status.csv
|
||||||
|
node_status_count : 3
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# handlers file for node_status
|
|
@ -1,2 +1,32 @@
|
|||||||
---
|
---
|
||||||
# tasks file for node_status
|
- name: Update node status when not running in a container
|
||||||
|
when: not ansible_virtualization_type | regex_search("docker|podman|container")
|
||||||
|
block:
|
||||||
|
- name: Create directory {{ node_status_dir }}
|
||||||
|
ansible.builtin.file:
|
||||||
|
path : "{{ node_status_dir }}"
|
||||||
|
state : directory
|
||||||
|
mode : '0755'
|
||||||
|
become : false
|
||||||
|
run_once : true
|
||||||
|
delegate_to : "{{ node_status_host }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Capture system uptime
|
||||||
|
ansible.builtin.command : uptime
|
||||||
|
register : r_node_status_uptime
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
|
||||||
|
- name: Log node status
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path : "{{ node_status_dir }}/{{ node_status_file }}"
|
||||||
|
state : present
|
||||||
|
regexp : "{{ inventory_hostname }}"
|
||||||
|
line : "{{ ansible_date_time.epoch }},,{{ inventory_hostname }},,{{ ansible_distribution }} {{ ansible_distribution_version }},,{{ r_node_status_uptime.stdout }}"
|
||||||
|
create : true
|
||||||
|
mode : '0644'
|
||||||
|
owner : "{{ node_status_user }}"
|
||||||
|
group : "{{ node_status_group }}"
|
||||||
|
delegate_to : "{{ node_status_host }}"
|
||||||
|
loop: "{{ range(0, node_status_count) | list }}"
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# vars file for node_status
|
|
Loading…
x
Reference in New Issue
Block a user