50 lines
1.3 KiB
YAML
50 lines
1.3 KiB
YAML
---
|
|
- name: Generate hardware report
|
|
hosts: all
|
|
become: yes
|
|
|
|
tasks:
|
|
- name: Download empty hwreport file
|
|
get_url:
|
|
url: http://utility.lab.example.com/files/hwreport.empty
|
|
dest: /root/hwreport.txt
|
|
mode: '0644'
|
|
|
|
- name: Set hostname
|
|
lineinfile:
|
|
path: /root/hwreport.txt
|
|
regexp: '^HOST='
|
|
line: "HOST={{ ansible_hostname }}"
|
|
|
|
- name: Set BIOS version
|
|
lineinfile:
|
|
path: /root/hwreport.txt
|
|
regexp: '^BIOS='
|
|
line: "BIOS={{ ansible_bios_version | default('NONE') }}"
|
|
|
|
- name: Set memory size
|
|
lineinfile:
|
|
path: /root/hwreport.txt
|
|
regexp: '^MEMORY='
|
|
line: "MEMORY={{ ansible_memtotal_mb }} MB"
|
|
|
|
- name: Set vdb disk size
|
|
lineinfile:
|
|
path: /root/hwreport.txt
|
|
regexp: '^VDB='
|
|
line: "VDB={{ ansible_devices.vdb.size | default('NONE') }}"
|
|
|
|
- name: Set vdc disk size
|
|
lineinfile:
|
|
path: /root/hwreport.txt
|
|
regexp: '^VDC='
|
|
line: "VDC={{ ansible_devices.vdc.size | default('NONE') }}"
|
|
|
|
- name: Set vdd disk size (NONE if missing)
|
|
lineinfile:
|
|
path: /root/hwreport.txt
|
|
regexp: '^VDD='
|
|
line: >-
|
|
VDD={{ ansible_devices.vdd.size if 'vdd' in ansible_devices else 'NONE' }}
|
|
|