79 lines
1.6 KiB
YAML
79 lines
1.6 KiB
YAML
|
---
|
||
|
- 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
|