44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
- name: Instalar pihole
|
|
hosts: pihole
|
|
become: true
|
|
vars_files:
|
|
- secrets.yml
|
|
|
|
tasks:
|
|
- name: Actualizar e instalar paquetes
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
upgrade: true
|
|
name:
|
|
- curl
|
|
|
|
- name: Crear carpeta para archivo necesario para unattended
|
|
ansible.builtin.file:
|
|
path: /etc/pihole
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Creando archivo necesario para unattended
|
|
ansible.builtin.copy:
|
|
content: ""
|
|
dest: /etc/pihole/setupVars.conf
|
|
force: false
|
|
mode: '0755'
|
|
|
|
- name: Descargar script
|
|
ansible.builtin.get_url:
|
|
url: https://install.pi-hole.net
|
|
dest: /tmp/install_pihole.sh
|
|
mode: '0755'
|
|
|
|
- name: Instalar pihole
|
|
ansible.builtin.command: /tmp/install_pihole.sh --unattended
|
|
environment:
|
|
PIHOLE_SKIP_OS_CHECK: "true"
|
|
args:
|
|
creates: '/usr/local/bin/pihole'
|
|
|
|
- name: Habilitar contraseña si no está configurada
|
|
ansible.builtin.command: pihole setpassword {{ pihole_password }}
|
|
changed_when: false
|