Compare commits

...

7 commits

Author SHA1 Message Date
Sven Velt 0ef7eb8905 Fix layout in start.j2 for unreachable hosts 2023-12-13 14:36:13 +01:00
Sven Velt 5e81102477 Add SSH-Version and dynamic key information 2022-09-28 15:28:35 +02:00
Sven Velt b0f743cccc Fixed wiki index if host is unreachable 2022-06-29 07:58:36 +02:00
Sven Velt ea68badfd7 Index: List of no-systemd hosts 2021-10-06 13:14:32 +02:00
Sven Velt c108a89431 Add tag "indexonly" 2021-10-06 13:14:01 +02:00
Sven Velt 12fff8c858 Install Python's RPM bindings (for package_facts) 2021-10-06 13:13:22 +02:00
Sven Velt c4e5053aba Add package/service facts, reorganize templates 2020-11-25 10:48:24 +01:00
3 changed files with 78 additions and 22 deletions

View file

@ -7,6 +7,27 @@
mode: 0755
run_once: True
- name: "[RPM] Install pythonX-rpm"
package:
name: "python{{ ansible_facts.python.version.major|replace('2', '') }}-rpm"
when: ansible_pkg_mgr in ["dnf", "zypper"]
- name: "[RPM] Install rpm-python"
package:
name: "rpm-python"
when: ansible_pkg_mgr in ["yum"]
- package_facts:
ignore_errors: True
- service_facts:
ignore_errors: True
- name: Get SSH version number
shell: 'ssh -V 2>&1 | grep -o "OpenSSH_[0-9]\+\.[0-9]" | grep -o "[0-9]\+\.[0-9]"'
changed_when: False
register: ssh_version
- name: write wiki page
local_action:
module: template
@ -19,4 +40,6 @@
src: start.j2
dest: "{{ doku_path }}/start.txt"
run_once: True
tags:
- indexonly

View file

@ -1,32 +1,46 @@
====== {{ inventory_hostname }} ======
* FQDN: {{ ansible_fqdn }} -- {{ ansible_default_ipv4.address }}
* Product: **{{ ansible_system_vendor|default("N/A") }}** {{ ansible_product_name|default("N/A") }} (S/N: {{ ansible_product_serial }}), {{ ansible_form_factor }}
* Virtualization: {{ ansible_virtualization_role }} / {{ ansible_virtualization_type }}
* CPUs: {{ ansible_processor_vcpus }} ( {{ ansible_processor_count }} x {{ ansible_processor_cores }} Cores x {{ ansible_processor_threads_per_core }} Threads )
* CPU-Type: {{ ansible_processor[2] }}
* RAM: {{ ansible_memtotal_mb }} MB
* Swap: {{ "%0.2f" % (ansible_swaptotal_mb / 1024) }} GB
* OS: {{ ansible_distribution }} {{ ansible_distribution_version }}
* Kernel: {{ ansible_kernel }}
* Init: {{ ansible_service_mgr }}
* IPs:
* IPv4: {{ ansible_all_ipv4_addresses|join(', ') }}
* IPv6: {{ ansible_all_ipv6_addresses|join(', ') }}
^ FQDN | {{ ansible_fqdn }} |
^ Product | **{{ ansible_system_vendor|default("N/A") }}** {{ ansible_product_name|default("N/A") }} |
^ S/N | {{ ansible_product_serial|default('N/A') }} |
^ Form factor | {{ ansible_form_factor|default('-') }} |
^ Virtualization | {{ ansible_virtualization_type|default('-')|upper }} - {{ ansible_virtualization_role|default('-')|capitalize }} |
^ 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 ) |
^ CPU-Type | {{ ansible_processor[2]|default(ansible_processor[1])|default('N/A') }} |
^ RAM | {{ "%0.2f" % (ansible_memtotal_mb|default(0) / 1024) }} GB ({{ ansible_memtotal_mb|default(0) }} MB) |
^ Swap | {% if ansible_swaptotal_mb|default(False) %}{{ "%0.2f" % (ansible_swaptotal_mb / 1024) }} GB ({{ansible_swaptotal_mb}} MB){% else %}N/A{% endif %} |
^ OS | {{ ansible_distribution }} {{ ansible_distribution_version }} "//{{ ansible_distribution_release|default('-') }}//" |
^ Kernel | {{ ansible_kernel }} |
^ Init | {{ ansible_service_mgr }} |
^ 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:
| Source | Mountpoint | Filesystem |
{% for m in ansible_mounts %}
{% for m in ansible_mounts|default([]) %}
| ''{{ m.device }}'' | ''{{ m.mount }}'' | ''{{ m.fstype }}'' |
{% endfor %}
* AppArmor: {{ ansible_apparmor.status }}
* SE-Linux: {{ ansible_selinux.status }}
* SSH-Host-Keys:
* DSA: ''{{ ansible_ssh_host_key_dsa_public|default("N/A") }}''
* RSA: ''{{ ansible_ssh_host_key_rsa_public|default("N/A") }}''
* ECDSA: ''{{ ansible_ssh_host_key_ecdsa_public|default("N/A") }}''
* Ed25519: ''{{ ansible_ssh_host_key_ed25519_public|default("N/A") }}''
* SSH Version {{ ssh_version.stdout_lines.0 }}:
{% for method in ["dsa", "rsa", "ecdsa", "ed25519", "xmss"] %}{% if ansible_facts["ssh_host_key_" + method + "_public"] is defined %} * {{ method|upper }}: <code>{{ ansible_facts["ssh_host_key_" + method + "_public_keytype"]|default("") }} {{ ansible_facts["ssh_host_key_" + method + "_public"] }}</code>
{% endif %}{% endfor %}
===== 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 }}//

View file

@ -1,4 +1,23 @@
{% for h in hostvars|sort %}
* [[ {{ h }} ]]
====== Alle Hosts ======
^ Host \\ IP ^ Hardware ^ Distribution \\ Version ^ Package Mgr \\ Installed ^ Service Mgr ^
{% 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 %}
===== Hosts ohne systemd =====
{% for h in hostvars|sort if hostvars[h]['ansible_service_mgr'] is defined and hostvars[h]['ansible_service_mgr'] != 'systemd' %}
* [[ {{ h }} | {{ h }} ({{ hostvars[h]['ansible_service_mgr'] }}) ]]
{% endfor %}