From 4f7f14de120a6cbad1a1d5f02f02646fb73e5f0b Mon Sep 17 00:00:00 2001 From: unman Date: Fri, 5 Aug 2022 12:18:39 +0000 Subject: [PATCH] Pi-hole - set IP for eth0 and update --- pihole/eth0 | 5 +++++ pihole/install.sls | 48 ++++++++++++++++++++++++++++++++++++++++++++++ pihole/install.top | 5 +++++ 3 files changed, 58 insertions(+) create mode 100644 pihole/eth0 create mode 100644 pihole/install.sls create mode 100644 pihole/install.top diff --git a/pihole/eth0 b/pihole/eth0 new file mode 100644 index 0000000..9fbf33c --- /dev/null +++ b/pihole/eth0 @@ -0,0 +1,5 @@ +auto eth0 +iface eth0 inet static +address +netmask 255.0.0.0 +gateway diff --git a/pihole/install.sls b/pihole/install.sls new file mode 100644 index 0000000..78bca7a --- /dev/null +++ b/pihole/install.sls @@ -0,0 +1,48 @@ +# vim: set syntax=yaml ts=2 sw=2 sts=2 et : +# + +{% if grains['nodename'] != 'dom0' %} + +/etc/apt/sources.list: + file.replace: + - names: + - /etc/apt/sources.list + - /etc/apt/sources.list.d/qubes-r4.list + - pattern: 'http://HTTPS///' + - repl: 'https://' + - flags: [ 'IGNORECASE', 'MULTILINE' ] + +{% set IP = salt['cmd.shell']('qubesdb-read /qubes-ip') %} +{% set GW = salt['cmd.shell']('qubesdb-read /qubes-gateway') %} + +/etc/network/interfaces.d/eth0: + file.managed: + - source: + - salt://pihole/eth0 + - user: root + - group: root + - makedirs: True + +set_ip: + file.line: + - name: /etc/network/interfaces.d/eth0 + - match: address + - mode: replace + - content: "address {{IP}}" + +set_gw: + file.line: + - name: /etc/network/interfaces.d/eth0 + - match: gateway + - mode: replace + - content: "gateway {{GW}}" + +'systemctl restart networking': + cmd.run: + - runas: root + +Pihole_update: + pkg.uptodate: + - refresh: True + +{% endif %} diff --git a/pihole/install.top b/pihole/install.top new file mode 100644 index 0000000..2dbf0e7 --- /dev/null +++ b/pihole/install.top @@ -0,0 +1,5 @@ +# vim: set syntax=yaml ts=2 sw=2 sts=2 et : + +base: + sys-pihole: + - pihole.install