1
0
Fork 0

Initial commit

This commit is contained in:
Andrew Tomaka 2022-12-21 22:56:39 -05:00
commit d6bd3862eb
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
19 changed files with 357 additions and 0 deletions

View file

@ -0,0 +1,25 @@
$ANSIBLE_VAULT;1.1;AES256
65383462643264626136333163366264353039393537313264303835393537396664633539616534
6664613531623666386661653330386538366466313133390a393562363835326136393664353334
62383932373036303233306138366464323463303238316434383264306632653533623665343066
3037326266326465300a653435646538613636336236343231376635646439663963346130656164
31383238613230356661626230353933346563333939383238336164336362323939666561306433
34353430633131663531333030636137396537643735666533633630393166363739663538363161
35373234623763346661656562346339366531663432666132356132323161323934323262653538
34626130383535396631646439303431363432383265636365633831626162656432333839326137
34386235643132366532316234396635366438623235636630663033396638336337666431653138
38343734663666343334616436363335353764366564376565313834326364646231303662643463
61643932366438366339383032306366376537326665393331333463656262373134656234393264
65626161656163396531313739323732313132623934336337386534366163313933613535323864
30303532396236613836316133363862663764333231326261366235353264356535326334353265
35313534616361316636383161363630393362333362623966373264393138646335316531633136
32333832643836646165643865636566663331333033303839653938653837353063366566623364
65636661623833376236613566623839633734333866393032613861646666333732386166633865
30616237663439383131653836303738653538353162333731343938643765333532373237353336
35363436643833643030663638333663633337326461663866386532396364313330656130653665
31333564363362613330363461383637666366333832326437666435336331643332376339623732
37363139666339313962633961363262343130323531313432623737663737643830316639623864
38393737313838343666376538616334363037353165323039626235646139346361343432316539
62303932306635303731646234633936373562656136623030656231616563623336393466616335
38306162393433306631383432346532376134323034616663373066303932376438656238336361
62336537383461343636

View file

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAQu1fLqmEcru0rAk8hTJ59WA3sLO7KDFIc4RgxCI0UP pihole

View file

@ -0,0 +1,6 @@
- name: Restart dnsmasq
service:
name: dnsmasq
enabled: true
state: restarted
when: ansible_facts.services['dnsmasq.service'] is defined

View file

@ -0,0 +1,78 @@
---
- name: Create pihole user
user:
name: pihole
groups: sudo
shell: /bin/bash
state: present
- name: Ensure .ssh directory exists.
file:
dest: /home/pihole/.ssh
mode: 0700
owner: pihole
state: directory
- name: Install ssh key
copy:
src: files/id_ed25519
dest: /home/pihole/.ssh/id_ed25519
mode: 0600
owner: pihole
- name: Set the authorized keys
authorized_key:
user: pihole
state: present
key: "{{ lookup('file', 'id_ed25519.pub') }}"
- name: Create pihole directory
file:
path: /etc/pihole
state: directory
- name: Configure pihole
template:
src: templates/setupVars.j2
dest: /etc/pihole/setupVars.conf
notify: Restart dnsmasq
- name: Download pihole installer
become: yes
become_user: pihole
get_url:
url: https://install.pi-hole.net
dest: /tmp/basic-install.sh
mode: 0755
- name: Install pihole
become: yes
become_user: pihole
command:
cmd: /tmp/basic-install.sh --unattended
creates: /usr/local/bin/pihole
- name: Create gravity directory
file:
path: /etc/gravity-sync
state: directory
- name: Configure gravity
template:
src: templates/gravity-sync.conf.j2
dest: /etc/gravity-sync/gravity-sync.conf
- name: Download gravity installer
become: yes
become_user: pihole
get_url:
url: https://raw.githubusercontent.com/vmstan/gs-install/main/gs-install.sh
dest: /tmp/gravity-install.sh
mode: 0755
- name: Install gravity
become: yes
become_user: pihole
command:
cmd: /tmp/gravity-install.sh --unattended
creates: /usr/local/bin/gravity-sync

View file

@ -0,0 +1,4 @@
REMOTE_HOST={{ sync_target }}
REMOTE_USER=pihole
GS_SSH_PKIF=/home/pihole/.ssh/id_ed25519

View file

@ -0,0 +1,16 @@
IPV4_ADDRESS={{ ansible_host }}/24
PIHOLE_INTERFACE=eth0
QUERY_LOGGING=true
INSTALL_WEB_SERVER=true
INSTALL_WEB_INTERFACE=true
LIGHTTPD_ENABLED=true
CACHE_SIZE=10000
DNS_FQDN_REQUIRED=true
DNS_BOGUS_PRIV=true
DNSMASQ_LISTENING=local
WEBPASSWORD=998ed4d621742d0c2d85ed84173db569afa194d4597686cae947324aa58ab4bb
BLOCKING_ENABLED=true
DNSSEC=false
REV_SERVER=false
PIHOLE_DNS_1=8.8.8.8
PIHOLE_DNS_2=8.8.4.4