Add package/service facts, reorganize templates
This commit is contained in:
parent
2473b97ac3
commit
c4e5053aba
|
@ -7,6 +7,12 @@
|
||||||
mode: 0755
|
mode: 0755
|
||||||
run_once: True
|
run_once: True
|
||||||
|
|
||||||
|
- package_facts:
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- service_facts:
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
- name: write wiki page
|
- name: write wiki page
|
||||||
local_action:
|
local_action:
|
||||||
module: template
|
module: template
|
||||||
|
|
|
@ -1,32 +1,48 @@
|
||||||
====== {{ inventory_hostname }} ======
|
====== {{ inventory_hostname }} ======
|
||||||
* FQDN: {{ ansible_fqdn }} -- {{ ansible_default_ipv4.address }}
|
^ FQDN | {{ ansible_fqdn }} |
|
||||||
* Product: **{{ ansible_system_vendor|default("N/A") }}** {{ ansible_product_name|default("N/A") }} (S/N: {{ ansible_product_serial }}), {{ ansible_form_factor }}
|
^ Product | **{{ ansible_system_vendor|default("N/A") }}** {{ ansible_product_name|default("N/A") }} |
|
||||||
* Virtualization: {{ ansible_virtualization_role }} / {{ ansible_virtualization_type }}
|
^ S/N | {{ ansible_product_serial|default('N/A') }} |
|
||||||
* CPUs: {{ ansible_processor_vcpus }} ( {{ ansible_processor_count }} x {{ ansible_processor_cores }} Cores x {{ ansible_processor_threads_per_core }} Threads )
|
^ Form factor | {{ ansible_form_factor|default('-') }} |
|
||||||
* CPU-Type: {{ ansible_processor[2] }}
|
^ Virtualization | {{ ansible_virtualization_type|default('-')|upper }} - {{ ansible_virtualization_role|default('-')|capitalize }} |
|
||||||
* RAM: {{ ansible_memtotal_mb }} MB
|
^ CPUs | {{ ansible_processor_vcpus|default('N/A') }} ( {{ ansible_processor_count|default('N/A') }} Socket/s x {{ ansible_processor_cores|default('N/A') }} Core/s x {{ ansible_processor_threads_per_core|default('N/A') }} Thread/s ) |
|
||||||
* Swap: {{ "%0.2f" % (ansible_swaptotal_mb / 1024) }} GB
|
^ CPU-Type | {{ ansible_processor[2]|default(ansible_processor[1])|default('N/A') }} |
|
||||||
* OS: {{ ansible_distribution }} {{ ansible_distribution_version }}
|
^ RAM | {{ "%0.2f" % (ansible_memtotal_mb|default(0) / 1024) }} GB ({{ ansible_memtotal_mb|default(0) }} MB) |
|
||||||
* Kernel: {{ ansible_kernel }}
|
^ Swap | {% if ansible_swaptotal_mb|default(False) %}{{ "%0.2f" % (ansible_swaptotal_mb / 1024) }} GB ({{ansible_swaptotal_mb}} MB){% else %}N/A{% endif %} |
|
||||||
* Init: {{ ansible_service_mgr }}
|
^ OS | {{ ansible_distribution }} {{ ansible_distribution_version }} "//{{ ansible_distribution_release|default('-') }}//" |
|
||||||
* IPs:
|
^ Kernel | {{ ansible_kernel }} |
|
||||||
* IPv4: {{ ansible_all_ipv4_addresses|join(', ') }}
|
^ Init | {{ ansible_service_mgr }} |
|
||||||
* IPv6: {{ ansible_all_ipv6_addresses|join(', ') }}
|
^ Default IP | {{ ansible_default_ipv4.address|default('') }} \\ {{ ansible_default_ipv6.address|default(False) }} |
|
||||||
|
^ IPv4 | {% if ansible_all_ipv4_addresses %}{{ ansible_all_ipv4_addresses|join(' \\\\ ') }}{% endif %} |
|
||||||
|
^ IPv6 | {% if ansible_all_ipv6_addresses %}{% for ip in ansible_all_ipv6_addresses %}{% if not ip.startswith('fe80') %}{{ ip }} \\ {% endif %}{% endfor %}{% endif %} |
|
||||||
|
|
||||||
Mountpoints:
|
Mountpoints:
|
||||||
| Source | Mountpoint | Filesystem |
|
| Source | Mountpoint | Filesystem |
|
||||||
{% for m in ansible_mounts %}
|
{% for m in ansible_mounts|default([]) %}
|
||||||
| ''{{ m.device }}'' | ''{{ m.mount }}'' | ''{{ m.fstype }}'' |
|
| ''{{ m.device }}'' | ''{{ m.mount }}'' | ''{{ m.fstype }}'' |
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
* AppArmor: {{ ansible_apparmor.status }}
|
* AppArmor: {{ ansible_apparmor.status }}
|
||||||
* SE-Linux: {{ ansible_selinux.status }}
|
* SE-Linux: {{ ansible_selinux.status }}
|
||||||
* SSH-Host-Keys:
|
* SSH-Host-Keys:
|
||||||
* DSA: ''{{ ansible_ssh_host_key_dsa_public|default("N/A") }}''
|
* DSA: <code>{{ ansible_ssh_host_key_dsa_public|default("N/A") }}</code>
|
||||||
* RSA: ''{{ ansible_ssh_host_key_rsa_public|default("N/A") }}''
|
* RSA: <code>{{ ansible_ssh_host_key_rsa_public|default("N/A") }}</code>
|
||||||
* ECDSA: ''{{ ansible_ssh_host_key_ecdsa_public|default("N/A") }}''
|
* ECDSA: <code>{{ ansible_ssh_host_key_ecdsa_public|default("N/A") }}</code>
|
||||||
* Ed25519: ''{{ ansible_ssh_host_key_ed25519_public|default("N/A") }}''
|
* Ed25519: <code>{{ ansible_ssh_host_key_ed25519_public|default("N/A") }}</code>
|
||||||
|
|
||||||
|
===== Packages =====
|
||||||
|
|
||||||
|
{% if ansible_facts.packages is defined %}^ Package ^ Version ^
|
||||||
|
{% for pkg in ansible_facts.packages | dictsort %}^ {{ pkg.0 }} | {{ pkg.1.0.version }}{% if pkg.1.0.release|default(False)|bool %}-{{ pkg.1.0.release }}{% endif %} |
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
===== Services =====
|
||||||
|
|
||||||
|
{% if ansible_facts.services is defined %}^ Service ^ State ^
|
||||||
|
{% for svc in ansible_facts.services %}{% if ansible_facts.services[svc]['state'] == "running" %}^ {{ svc }} | {{ ansible_facts.services[svc]['state'] }} |
|
||||||
|
{% endif %}{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
//{{ ansible_managed }}//
|
//{{ ansible_managed }}//
|
||||||
|
|
|
@ -1,4 +1,16 @@
|
||||||
{% for h in hostvars|sort %}
|
^ Host \\ IP ^ Hardware ^ Distribution \\ Version ^ Package Mgr \\ Installed ^ Service Mgr ^
|
||||||
* [[ {{ h }} ]]
|
{% for h in hostvars|sort %}^ [[ {{ h }} ]] \\ {{ hostvars[h]['ansible_default_ipv4']['address']|default('-') }} {#
|
||||||
|
#}{% if 'ansible_distribution' in hostvars[h] %} {#
|
||||||
|
#}|{% if hostvars[h]['ansible_virtualization_type']|default('-') == "lxc"
|
||||||
|
%}LXC{% else
|
||||||
|
%}{% if hostvars[h]['ansible_virtualization_role']|default('-') == 'guest'
|
||||||
|
%}({{ hostvars[h]['ansible_virtualization_type']|default('-')|upper}}) {% endif
|
||||||
|
%}**{{ hostvars[h]['ansible_system_vendor']|default('-') }}** \\ {{ hostvars[h]['ansible_product_name']|default('-') }}{#
|
||||||
|
#}{% endif
|
||||||
|
%}| **{{ hostvars[h]['ansible_distribution'] }}** \\ {{ hostvars[h]['ansible_distribution_version'] }} - {{ hostvars[h]['ansible_distribution_release']|default('-') }}{#
|
||||||
|
#}| {{ hostvars[h]['ansible_pkg_mgr'] }} / {{ (hostvars[h]['ansible_facts']['packages'])|default([])|length }} {#
|
||||||
|
#}| {{ hostvars[h]['ansible_service_mgr'] }} |
|
||||||
|
{% else %}||||||
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue