pihole silent install

This commit is contained in:
janic 2021-12-06 14:00:39 +01:00
parent b028601db6
commit a0c0c11c1b
8 changed files with 75 additions and 1 deletions

View File

@ -58,7 +58,7 @@ APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner] Copyright 2021 Janic Voser
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -0,0 +1,4 @@
---
- name: Install Pihole
shell: curl -sSL https://install.pi-hole.net | bash
...

View File

View File

@ -0,0 +1,12 @@
- name: Load variable files
include_vars: "{{ item }}"
with_first_found:
- "pihole_{{ ansible_os_family }}.yaml"
- "pihole_default.yaml"
- name: Update APT-cache if Debianbased
apt: update_cache=yes cache_valid_time=3600
when: ansible_os_family == 'Debian'
- name: Install curl
package:
name: curl
state: latest

6
hosts Normal file
View File

@ -0,0 +1,6 @@
[lxc-pihole]
pihole01.voser.local ansible_host=172.22.0.11
pihole02.voser.local ansible_host=172.22.0.12
[lxc-pihole:vars]
ansible_user=root
ansible_port=22

25
pihole-playbook.yaml Normal file
View File

@ -0,0 +1,25 @@
---
- name: pihole-playbook
hosts: lxc-pihole
gather_facts: yes
handlers:
- import_tasks: additional/handler-pihole.yaml
pre_tasks:
- import_tasks: additional/pre_tasks-pihole.yaml
tasks:
- name: Create /etc/pihole
file:
path: /etc/pihole
state: directory
mode: '0644'
- name: Create Config
template:
src: templates/pihole-setupVars.conf.j2
dest: /etc/pihole/setupVars.conf
register: template
- name: pihole install
shell: curl -L https://install.pi-hole.net | bash /dev/stdin --unattended
when: template.changed
...

7
pihole-test.yaml Normal file
View File

@ -0,0 +1,7 @@
---
- name: test
hosts: lxc-pihole
tasks:
- debug: var=ansible_all_ipv4_addresses
- debug: var=hostvars[inventory_hostname]['ansible_default_ipv4']['address']

View File

@ -0,0 +1,20 @@
WEBPASSWORD=a215bae8b5ec659b0980a76dlkds09644731cd439cab41494447a8705c22b3aa41c
PIHOLE_INTERFACE=eth0
IPV4_ADDRESS={{ ansible_eth0.ipv4.address }}/22
IPV6_ADDRESS=
QUERY_LOGGING=true
INSTALL_WEB=true
DNSMASQ_LISTENING=single
PIHOLE_DNS_1=1.1.1.1
PIHOLE_DNS_2=1.0.0.1
PIHOLE_DNS_3=9.9.9.9
PIHOLE_DNS_4=149.112.112.11
DNS_FQDN_REQUIRED=true
DNS_BOGUS_PRIV=true
DNSSEC=true
TEMPERATUREUNIT=C
WEBUIBOXEDLAYOUT=traditional
API_EXCLUDE_DOMAINS=
API_EXCLUDE_CLIENTS=
API_QUERY_LOG_SHOW=all
API_PRIVACY_MODE=false