Quellcode durchsuchen

ansible: debian_setup: add tasks for static ip

pull/1/head
10sr vor 10 Jahren
Ursprung
Commit
96b5b5b6c0
2 geänderte Dateien mit 29 neuen und 1 gelöschten Zeilen
  1. +5
    -0
      ansible/debian_setup.static_ip.interfaces
  2. +24
    -1
      ansible/debian_setup.yml

+ 5
- 0
ansible/debian_setup.static_ip.interfaces Datei anzeigen

@@ -0,0 +1,5 @@
auto eth0
iface eth0 inet static
address 192.168.2.4
netmask 255.255.255.0
gateway 192.168.2.1

+ 24
- 1
ansible/debian_setup.yml Datei anzeigen

@@ -1,5 +1,28 @@
---
- hosts: all
vars:
sudo: yes
tasks:
- name: put interfaces file for fixed IP
- name: add line to source interfaces.d
lineinfile: dest=/etc/network/interfaces
line="source-directory interfaces.d"
backup=yes
- name: comment allow-hotplug eth0
lineinfile: dest=/etc/network/interfaces
line="# allow-hotplug eth0"
regexp="allow-hotplug eth0"
backup=yes
- name: comment dhcp setup for eth0
lineinfile: dest=/etc/network/interfaces
line="# iface eth0 inet dhcp"
regexp="iface eth0 inet dhcp"
backup=yes
- name: put interfaces file for static IP
copy: src=debian_setup.static_ip.interfaces
dest=/etc/network/interfaces.d/static_ip
notify:
- restart network service

handlers:
- name: restart networking service
service: name=networking state=restarted

Laden…
Abbrechen
Speichern