Software aufgeteilt v1
This commit is contained in:
parent
0ccf139311
commit
0d2c927d37
22 changed files with 384 additions and 365 deletions
25
qgm_create_inventory.yml
Normal file
25
qgm_create_inventory.yml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
# 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
|
||||
vars:
|
||||
csv_hosts: "{{ out.stdout_lines|map('split', ';')|groupby('0') }}"
|
||||
ini_hosts: |
|
||||
{% for group in csv_hosts %}
|
||||
[{{ group.0 }}]
|
||||
{% 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 .
|
||||
- shell: cat devices.csv | grep -v ^# | grep -v ^$
|
||||
register: out
|
||||
- copy:
|
||||
dest: devices.ini
|
||||
content: "{{ ini_hosts }}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue