Ansible-lint fixes
All checks were successful
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-centos) (push) Successful in 13s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian) (push) Successful in 12s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-fedora) (push) Successful in 13s
All checks were successful
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-centos) (push) Successful in 13s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian) (push) Successful in 12s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-fedora) (push) Successful in 13s
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
---
|
||||
requires_ansible: ">=2.14.0"
|
||||
requires_ansible: ">=2.15.0"
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Format uptime using Jinja
|
||||
ansible.builtin.set_fact:
|
||||
uptime_formatted: |
|
||||
motd_uptime_formatted: |
|
||||
{% if 'day' in motd_host_uptime %}
|
||||
{{ motd_host_uptime | regex_replace(motd_day_filter, motd_day_filter_repl) }}
|
||||
{% else %}
|
||||
@ -11,10 +11,10 @@
|
||||
|
||||
- name: Update MOTD
|
||||
ansible.builtin.template:
|
||||
src : templates/motd.j2
|
||||
dest : "{{ motd_motd_file }}"
|
||||
mode : "0644"
|
||||
changed_when : false
|
||||
src: templates/motd.j2
|
||||
dest: "{{ motd_motd_file }}"
|
||||
mode: "0644"
|
||||
changed_when: false
|
||||
|
||||
|
||||
...
|
||||
|
@ -19,6 +19,6 @@ IP : {{ motd_host_ip }}
|
||||
CPU : {{ ansible_processor_vcpus }} x {{ ansible_processor[2] | regex_replace('\\s+', ' ') }}
|
||||
Memory : {{ "{0:0.2f}".format(ansible_memfree_mb/1024) }} GB free of {{ (ansible_memtotal_mb/1024)|round}} GB
|
||||
Platform : {{ ansible_distribution }} {{ ansible_distribution_version }} {{ ansible_kernel }}
|
||||
Up : {{ uptime_formatted | trim }}
|
||||
Up : {{ motd_uptime_formatted | trim }}
|
||||
|
||||
|
||||
|
@ -11,19 +11,17 @@
|
||||
run_once: true
|
||||
delegate_to: "{{ node_status_host }}"
|
||||
|
||||
|
||||
- name: Capture system uptime
|
||||
ansible.builtin.command : uptime
|
||||
register: r_node_status_uptime
|
||||
register: node_status_sys_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 }}"
|
||||
line: "{{ ansible_date_time.epoch }},,{{ inventory_hostname }},,{{ ansible_distribution }} {{ ansible_distribution_version }},,{{ node_status_sys_uptime.stdout }}"
|
||||
create: true
|
||||
mode: '0644'
|
||||
owner: "{{ node_status_user }}"
|
||||
|
Reference in New Issue
Block a user