First commit
This commit is contained in:
28
ansible/pihole/configure.yml
Normal file
28
ansible/pihole/configure.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
- name: Configurar Pihole
|
||||
hosts: pihole
|
||||
become: false
|
||||
|
||||
tasks:
|
||||
- name: Autenticar la API de pihole
|
||||
ansible.builtin.uri:
|
||||
url: http://localhost/api/auth
|
||||
method: POST
|
||||
body: |
|
||||
{
|
||||
"password": "{{ pihole_password }}"
|
||||
}
|
||||
body_format: json
|
||||
return_content: true
|
||||
register: auth_response
|
||||
changed_when: false
|
||||
|
||||
- name: Extraer SID de la respuesta de autenticación
|
||||
ansible.builtin.set_fact:
|
||||
pihole_sid: "{{ auth_response.json.session.sid | urlencode }}"
|
||||
|
||||
- name: Configurar pihole
|
||||
ansible.builtin.uri:
|
||||
url: http://localhost/api/config?sid={{ pihole_sid }}
|
||||
method: PATCH
|
||||
src: config.json
|
||||
body_format: json
|
||||
Reference in New Issue
Block a user