Updated with new role and added config to update pihole config

This commit is contained in:
Ash Leece 2021-01-26 12:11:58 +00:00
parent f6dcc68093
commit 53302049d3
2 changed files with 29 additions and 0 deletions

View File

@ -13,14 +13,23 @@
register: download
when: ansible_architecture == 'aarch64'
- name: Download required bin (amd64)
get_url:
url: https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
dest: /tmp/
register: download
when: ansible_architecture == 'x86_64'
- name: Add cloudflared user
user:
name: cloudflared
shell: /usr/sbin/nologin
append: yes
become: yes
- name: Copy to /usr/local/bin
copy:
remote_src: yes
src: "{{ download.dest }}"
dest: /usr/local/bin/cloudflared
mode: "u=rx,g=rx,o="
@ -30,4 +39,8 @@
- name: Configure service
import_tasks: service.yml
become: yes
- name: Configure Pi-Hole
import_tasks: pihole.yml
become: yes

16
tasks/pihole.yml Normal file
View File

@ -0,0 +1,16 @@
---
- name: Update Pi-Hole DNS line 1
lineinfile:
path: /etc/pihole/setupVars.conf
regexp: '^PIHOLE_DNS_1=.*'
line: PIHOLE_DNS_1=127.0.0.1#5053
- name: Update Pi-Hole DNS line 2
lineinfile:
path: /etc/pihole/setupVars.conf
regexp: '^PIHOLE_DNS_2=.*'
line: PIHOLE_DNS_2=
- name: Restart Pi-Hole to pick up new DNS config
shell:
cmd: 'pihole restartdns'