Ansible playbook for configuring a fresh install of Raspbian
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rpi-ansible/roles/static-ip/tasks/main.yml

15 lines
644 B

# 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