My Ansible playbooks to install my Raspberry PI
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

---
- name: Create a folder for the pi-hole installer
file:
path: /usr/local/src/pi-hole
state: directory
- name: 'Fetch the pi-hole installer'
get_url:
dest: /usr/local/src/pi-hole/basic-install.sh
url: '{{ pihole_installer_url }}'
validate_certs: yes
sha256sum: '{{ pihole_installer_sha256sum|default(omit) }}'
mode: 0755
register: pihole_installer
- name: 'Make sure /etc/pihole exists'
file:
state: directory
path: /etc/pihole
owner: root
group: root
mode: 0755
- name: 'Generate the pi-hole unattended installation script'
template:
src: setupVars.conf.j2
dest: /etc/pihole/setupVars.conf
owner: root
group: root
mode: 0644
register: pihole_config
- name: Run the pi-hole installer
command: /usr/local/src/pi-hole/basic-install.sh --unattended
when: pihole_config.changed or pihole_installer.changed
- name: Fix dnsmasq logfile ownership
file:
path: /var/log/pihole.log
setype: dnsmasq_var_log_t
seuser: system_u
register: log_file_permissions
- name: Restart dnsmasq
service:
name: dnsmasq
state: restarted
when: log_file_permissions.changed