Bestand aus ~/ansible-schule uebernehmen (Push-Setup, Stand Feb 2026)
Playbooks, Inventory, update-ips.sh, first-boot-setup.sh und Doku unveraendert aus dem alten git-losen Ordner uebernommen. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
24
playbooks/set-hostname.yml
Normal file
24
playbooks/set-hostname.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
# Hostname setzen
|
||||
#
|
||||
# Verwendung:
|
||||
# ansible-playbook playbooks/set-hostname.yml --limit laptop05 -e "new_hostname=laptop05"
|
||||
#
|
||||
---
|
||||
- name: Hostname setzen
|
||||
hosts: all
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
- name: Hostname setzen
|
||||
hostname:
|
||||
name: "{{ new_hostname | default(inventory_hostname) }}"
|
||||
|
||||
- name: /etc/hosts aktualisieren
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
regexp: '^127\.0\.1\.1'
|
||||
line: "127.0.1.1\t{{ new_hostname | default(inventory_hostname) }}"
|
||||
|
||||
- name: Neuer Hostname
|
||||
debug:
|
||||
msg: "Hostname gesetzt auf: {{ new_hostname | default(inventory_hostname) }}"
|
||||
Reference in New Issue
Block a user