0ba0c1ae16
the clients
58 lines
1.2 KiB
YAML
58 lines
1.2 KiB
YAML
---
|
|
- name: Update APT package cache
|
|
apt:
|
|
update_cache: true
|
|
upgrade: dist
|
|
|
|
- name: Install git package
|
|
apt:
|
|
name: "git"
|
|
state: present
|
|
|
|
- name: '[main] Make sure /etc/pihole directory exists'
|
|
file:
|
|
state: directory
|
|
path: /etc/pihole
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
become: yes
|
|
|
|
- name: '[install] Clone pihole repo'
|
|
git:
|
|
repo: https://github.com/pi-hole/pi-hole.git
|
|
depth: 1
|
|
dest: /tmp/pi-hole
|
|
version: master
|
|
|
|
- name: '[install] Generate /etc/pihole/setupVars.conf for unattended install if it does not exist or if upgrading'
|
|
template:
|
|
src: setupVars.conf
|
|
dest: /etc/pihole/setupVars.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
become: yes
|
|
|
|
- name: '[install] Install pihole'
|
|
command: 'bash /tmp/pi-hole/automated\ install/basic-install.sh --unattended'
|
|
become: yes
|
|
|
|
- name: '[install] Generate /etc/dnsmasq.d/01-pihole.conf'
|
|
template:
|
|
src: 01-pihole.conf
|
|
dest: /etc/dnsmasq.d/01-pihole.conf
|
|
become: yes
|
|
|
|
- name: '[install] Set cron job for daily pihole updates'
|
|
cron:
|
|
name: "daily pihole updater"
|
|
user: "{{ ansible_user_id }}"
|
|
minute: "0"
|
|
hour: "4"
|
|
job: "/usr/local/bin/pihole -up"
|
|
become: yes
|
|
tags: pihole
|
|
|
|
|