|
|
@ -37,12 +37,12 @@ |
|
|
set_fact: |
|
|
set_fact: |
|
|
interface_name: "{{ dhcp_interface.stdout_lines[0] }}" |
|
|
interface_name: "{{ dhcp_interface.stdout_lines[0] }}" |
|
|
|
|
|
|
|
|
- name: Configure interface for static IP (rest of the tasks) |
|
|
|
|
|
ansible.builtin.lineinfile: |
|
|
|
|
|
path: /etc/network/interfaces |
|
|
|
|
|
regexp: '^iface {{ interface_name }} inet dhcp' |
|
|
|
|
|
line: 'iface {{ interface_name }} inet static' |
|
|
|
|
|
backup: yes |
|
|
|
|
|
|
|
|
# - name: Configure interface for static IP (rest of the tasks) |
|
|
|
|
|
# ansible.builtin.lineinfile: |
|
|
|
|
|
# path: /etc/network/interfaces |
|
|
|
|
|
# regexp: '^iface {{ interface_name }} inet dhcp' |
|
|
|
|
|
# line: 'iface {{ interface_name }} inet static' |
|
|
|
|
|
# backup: yes |
|
|
|
|
|
|
|
|
# - name: Sichere die aktuelle Netzwerkkonfiguration |
|
|
# - name: Sichere die aktuelle Netzwerkkonfiguration |
|
|
# copy: |
|
|
# copy: |
|
|
@ -55,7 +55,7 @@ |
|
|
block: | |
|
|
block: | |
|
|
iface {{ interface_name }} inet static |
|
|
iface {{ interface_name }} inet static |
|
|
address {{ static_ip }} |
|
|
address {{ static_ip }} |
|
|
netmask {{ netmask }} |
|
|
|
|
|
|
|
|
netmask {{ netmask2 }} |
|
|
gateway {{ gateway }} |
|
|
gateway {{ gateway }} |
|
|
dns-nameservers {{ dns_servers | join(' ') }} |
|
|
dns-nameservers {{ dns_servers | join(' ') }} |
|
|
- name: Starte Netzwerk neu |
|
|
- name: Starte Netzwerk neu |
|
|
|