# Ansible playbook for installing a Puomi Internet router. - hosts: image tasks: - name: "unset root password so that virtual console logins work" shell: | sed -i '/^root:[^:]*:/s//root::/' /etc/passwd /etc/shadow # Install software we'll need for router functionality. - name: "add contrib and non-free to APT sources, for firmware" apt_repository: repo: | deb http://deb.debian.org/debian {{ hostvars[inventory_hostname]["ansible_distribution_release"] }} contrib non-free update_cache: no - name: "update apt lists" shell: | set -xeu ls -la /etc rm /etc/resolv.conf echo nameserver 8.8.8.8 > /etc/resolv.conf apt-get update echo update done - name: "install software" apt: name: - bind9-dnsutils - bridge-utils - dnsmasq # Network configuration. - name: "configure bridge device br0 for local network ports" copy: content: | [NetDev] Name=br0 Kind=bridge dest: /etc/systemd/network/br0.netdev - name: "add local network ports to br0" copy: content: | [Match] Name=eth[^0]* [Network] Bridge=br0 dest: /etc/systemd/network/local.network - name: "configure bridge br0" copy: content: | [Match] Name=br0 [Network] Address={{ puomi_lan_ip }}/24 DHCPServer=false IPForward=true IPMasquerade=true ConfigureWithoutCarrier=true dest: /etc/systemd/network/br0.network - name: "configure dnsmasq for configuration .d directory support" lineinfile: path: /etc/dnsmasq.conf regexp: ^conf-dir line: "conf-dir=/etc/dnsmasq.d/,*.conf" - name: "configure dnsmasq for local bridge br0" copy: content: | dhcp-range={{ puomi_dhcp_start }},{{ puomi_dhcp_end }},{{ puomi_dhcp_netmask }},{{ puomi_dhcp_lease }} host-record={{ hostname }},{{ puomi_lan_ip }} interface=br0 max-cache-ttl=30 neg-ttl=10 dest: /etc/dnsmasq.d/router.conf vars: ansible_python_interpreter: /usr/bin/python3 puomi_lan_ip: 10.1.1.1 puomi_dhcp_start: 10.1.1.10 puomi_dhcp_end: 10.1.1.250 puomi_dhcp_netmask: 255.255.255.0 puomi_dhcp_lease: 1h