Giter Club home page Giter Club logo

pihole's Introduction

pihole raspberry pi ansible role

Role installs and configures Pihole https://pi-hole.net/ with unattentded setup

Documents relating to pi-hole are at https://docs.pi-hole.net/

Requirements

User with sudo access to the machine.

other prerequisites

Required Variables

pihole_setupvars_webpassword

You will need to generate a admin password for the pihole_setupvars_webpassword variable, password is hashed with sha256 twice. You can genearte a password with the following shell command.

With the password in a file (recommended).

echo -n $(cat ~/piholepass.word) | sha256sum | awk '{printf "%s", $1}' | sha256sum

With the password in shell command (not recommended)

echo -n notsosecretpassword | sha256sum | awk '{printf "%s", $1}' | sha256sum

recommended to store this variable in ansible vault.

pihole_setupvars_ipv4_address

IPv4 adress of the pihole

pihole_setupvars_pihole_dns_1/2

DNS servers you want the pihole to use

DNS

Alternative DNS Providers

Google: https://developers.google.com/speed/public-dns
  - 8.8.8.8
  - 8.8.4.4

OpenDNS: https://use.opendns.com/
  - 208.67.222.222
  - 208.67.220.220

Cloudflare: https://1.1.1.1/dns/
  - 1.1.1.1
  - 1.0.0.1

Role Variables

defaults/main.yml for default values

Example Playbook

---
- name: pihole
  hosts: pi
  strategy: free
  become_method: sudo
  become: yes
  gather_facts: yes
  vars:
    pihole_setupvars_ipv4_address: 192.168.1.100
    pihole_setupvars_webpassword: 35030714f1136486a612d7014b739a6c7ef3be589bb14b14a3d01f521dd7ef18
    pihole_setupvars_pihole_dns_1: 1.1.1.1
    pihole_setupvars_pihole_dns_2: 1.0.0.1
  roles:
    - zfuller.pihole

pihole's People

Contributors

ghoost82 avatar jenstimmerman avatar zfuller avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

pihole's Issues

pihole installer is run every time, also on no change in git checkout

When this role is ran the pihole installer script is always ran, even if the git checkout shows that no changes were made to the underlying code.
I believe that in this case the installer does not need to rerun.

PLAYBOOK: test.yml ***********************************************************************************************************************************************************************************************************************************************************************
3 plays in test.yml

PLAY [install pihole] ********************************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************************************************************************************************************************************
task path: /root/ansible/test.yml:2
ok: [pihole]
META: ran handlers

TASK [zfuller.pihole : ensure git] *******************************************************************************************************************************************************************************************************************************************************
task path: /root/.ansible/roles/zfuller.pihole/tasks/main.yml:2
ok: [pihole] => {"changed": false, "msg": "Nothing to do", "rc": 0, "results": []}

TASK [zfuller.pihole : cloning pihole] ***************************************************************************************************************************************************************************************************************************************************
task path: /root/.ansible/roles/zfuller.pihole/tasks/main.yml:7
ok: [pihole] => {"after": "6b536b7428a1f57ff34ddc444ded6d3a62b00a38", "before": "6b536b7428a1f57ff34ddc444ded6d3a62b00a38", "changed": false, "remote_url_changed": false}

TASK [zfuller.pihole : making directories] ***********************************************************************************************************************************************************************************************************************************************
task path: /root/.ansible/roles/zfuller.pihole/tasks/main.yml:14
changed: [pihole] => {"changed": true, "gid": 993, "group": "pihole", "mode": "0755", "owner": "pihole", "path": "/etc/pihole/", "size": 4096, "state": "directory", "uid": 996}

TASK [zfuller.pihole : pushing config file setupVars] ************************************************************************************************************************************************************************************************************************************
task path: /root/.ansible/roles/zfuller.pihole/tasks/main.yml:20
changed: [pihole] => {"changed": true, "checksum": "9f9ef421e2b722483eed2508ed0ba728ee3e4b2d", "dest": "/etc/pihole/setupVars.conf", "gid": 0, "group": "root", "md5sum": "1f513a80dfd73207dca9d39168736804", "mode": "0644", "owner": "root", "size": 506, "src": "/root/.ansible/tmp/ansible-tmp-1601211093.2265966-23363-209798326403475/source", "state": "file", "uid": 0}

TASK [zfuller.pihole : installing pihole] ************************************************************************************************************************************************************************************************************************************************
task path: /root/.ansible/roles/zfuller.pihole/tasks/main.yml:26
changed: [pihole] => {"changed": true, "cmd": "bash basic-install.sh --unattended ", "delta": "0:01:40.522066", "end": "2020-09-27 12:53:14.707935", "rc": 0, "start": "2020-09-27 12:51:34.185869", "stderr": "", "stderr_lines": [], "stdout": "\n  [โœ“] Root user check\n\n        .;;,.\n        .ccccc:,.\n         :cccclll:.      ..,,\n          :ccccclll.   ;ooodc\n           'ccll:;ll .oooodc\n             .;cll.;;looo:.\n                 .. ','.\n                .',,,,,,'.\n              .',,,,,,,,,,.\n            .',,,,,,,,,,,,....\n          ....''',,,,,,,'.......\n        .........  ....  .........\n        ..........      ..........\n        ..........      ..........\n        .........  ....  .........\n          ........,,,,,,,'......\n            ....',,,,,,,,,,,,.\n               .',,,,,,,,,'.\n 
<snip>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.