mirror of
https://github.com/ruanbekker/rpi-ansible.git
synced 2025-04-20 09:11:45 +02:00
Create main.yml
This commit is contained in:
parent
148b123dcd
commit
7348dbeb95
15
roles/static-ip/tasks/main.yml
Normal file
15
roles/static-ip/tasks/main.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# https://github.com/vicchi/ansible-pi-lockdown/blob/master/roles/static-ip/tasks/main.yml
|
||||||
|
---
|
||||||
|
- name: Configure static IP in /etc/dhcpcd.conf
|
||||||
|
become: yes
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/dhcpcd.conf
|
||||||
|
regexp: "{{ item.regexp }}"
|
||||||
|
line: "{{ item.line }}"
|
||||||
|
state: present
|
||||||
|
with_items:
|
||||||
|
- { regexp: "^interface eth[0-9]$", line: "interface {{ interface }}" }
|
||||||
|
- { regexp: "^static ip_address", line: "static ip_address={{ ipaddress }}" }
|
||||||
|
- { regexp: "^static routers", line: "static routers={{ routers }}" }
|
||||||
|
- { regexp: "^static domain_name_servers", line: "static domain_name_servers={{ dns_servers }}" }
|
||||||
|
notify: reboot
|
Loading…
x
Reference in New Issue
Block a user