Added Playbook for Schuelerlaptops for testing

This commit is contained in:
Frank Schiebel 2023-09-13 16:14:09 +02:00
parent de3ba99106
commit 6ee40cdec0
9 changed files with 301 additions and 21 deletions

View file

@ -1,3 +1,9 @@
---
# Dieses Playbook holt die devices.csv vom Schulserver
# und baut daraus ein ansible inventory
# Damit das geht, muss der ansible Benutzer des netboot-Servers
# die devices.csv per scp vom Server holen können
# - Frank Schiebel, 09/2023
- hosts: localhost
gather_facts: false
become: false
@ -6,10 +12,9 @@
ini_hosts: |
{% for group in csv_hosts %}
[{{ group.0 }}]
{% for host in group.1|map(attribute='1') %}
{{ host }}
{% for line in group.1 %}
{{ line[1] }} mac={{ line[3] }} ip={{ line[4] }} type={{ line[8] }} pxe={{ line[10] }}
{% endfor %}
{% endfor %}
tasks:
- shell: scp linuxadmin@server:/etc/linuxmuster/sophomorix/default-school/devices.csv .
@ -18,4 +23,3 @@
- copy:
dest: devices.ini
content: "{{ ini_hosts }}"