-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfacts.yaml
More file actions
37 lines (34 loc) · 1.21 KB
/
facts.yaml
File metadata and controls
37 lines (34 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#- name: Generate host system facts
# hosts: all
# become: true
# tasks:
# - name: 헤더 생성
# copy:
# content: |
# Hostname OS Memory(MB) CPU_Core remain
# dest: "./facts.txt"
# delegate_to: localhost
# run_once: true
#
# - name: add facts to facts.txt
# lineinfile:
# path: "./facts.txt"
# line: "{{ inventory_hostname }} {{ ansible_distribution }} {{ ansible_memtotal_mb }} {{ ansible_processor_count }} {{ ansible_mounts[0].size_available }}"
## line: "{{ inventory_hostname }} {{ ansible_distribution }} {{ ansible_memtotal_mb }} {{ ansible_processor_count }}"
# delegate_to: localhost
- name: Generate host system facts
hosts: all
become: true
tasks:
- name: 헤더 생성
copy:
content: |
Hostname OS Memory(MB) CPU_Core remain
dest: "./facts.txt"
delegate_to: localhost
run_once: true
- name: add facts to facts.txt
lineinfile:
path: "./facts.txt"
line: "{{ inventory_hostname }} {{ ansible_distribution }} {{ ansible_memtotal_mb }} {{ ansible_processor_count }} {{ (ansible_mounts[0].size_available / 1024 / 1024) | round(2) }}MB"
delegate_to: localhost