1
0
Fork 0
home-ansible/roles/pihole/tasks/main.yml

87 lines
1.7 KiB
YAML
Raw Normal View History

2022-12-21 22:56:39 -05:00
---
- 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
2023-02-23 20:57:46 -05:00
- name: Schedule upgrade
cron:
name: schedule upgrade
weekday: "{{ update_weekday }}"
hour: 3
minute: 0
job: /usr/local/bin/pihole -up
2022-12-21 22:56:39 -05:00
- 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