It´s a very small playbook.

---
  - name: Update pi-hole servers
    hosts: pihole
    become: yes
    vars_files:
      - /etc/ansible/vars/pi-hole.yml

    tasks:
      - name: Update pi-hole
        shell: "pihole -up"

  - name: Reconfigure DHCP to give both DNS servers
    hosts: zeropi.morelos.lan
    become: yes
    tasks:
      - name: Reconfigure DHCP
        blockinfile:
          path: /etc/dnsmasq.d/02-pihole-dhcp.conf
          block: "dhcp-option=6,192.168.0.6,192.168.0.7"
          insertafter: "dhcp-option=option:router,192.168.0.1"
          state: present

      - name: Restart service
        service: 
          name: pihole-FTL
          state: restarted



And this is the file that I want to change every time the pi-hole is 
updated.
/etc/dnsmasq.d/02-pihole-dhcp.conf

###############################################################################
#  DHCP SERVER CONFIG FILE AUTOMATICALLY POPULATED BY PI-HOLE WEB 
INTERFACE.  #
#            ANY CHANGES MADE TO THIS FILE WILL BE LOST ON CHANGE           
  #
###############################################################################
dhcp-authoritative
dhcp-range=192.168.0.50,192.168.0.199,6h
dhcp-option=option:router,192.168.0.1
# BEGIN ANSIBLE MANAGED BLOCK
dhcp-option=6,192.168.0.6,192.168.0.7
# END ANSIBLE MANAGED BLOCK
dhcp-leasefile=/etc/pihole/dhcp.leases
#quiet-dhcp

domain=morelos.lan
local=/morelos.lan/




El miércoles, 5 de julio de 2023 a las 16:00:23 UTC-3, Dick Visser escribió:

> On Wed, 5 Jul 2023 at 19:22, Diego Lista <[email protected]> wrote:
> >
> > Hello group,
> >
> > I would like to share this strange behavior.
> > PLAY [Update pi-hole servers] 
> ************************************************************************************************
> >
> > TASK [Gathering Facts] 
> *******************************************************************************************************
> > ok: [zeropi.morelos.lan]
> > ok: [opizero.morelos.lan]
> >
> > TASK [Update pi-hole] 
> ********************************************************************************************************
> > changed: [zeropi.morelos.lan]
> > changed: [opizero.morelos.lan]
> >
> > PLAY [Reconfigure DHCP to give both DNS servers] 
> *****************************************************************************
> >
> > TASK [Gathering Facts] 
> *******************************************************************************************************
> > fatal: [zeropi.morelos.lan]: UNREACHABLE! => {"changed": false, "msg": 
> "Failed to connect to the host via ssh: [email protected]: 
> Permission denied (publickey,password).", "unreachable": true}
> > to retry, use: --limit @/etc/ansible/playbooks/pi-hole_update.retry
>
>
> Based on the above, some tasks succeed, and then after a task called
> [Reconfigure DHCP to give both DNS servers], things break.
> That would point to some problem there, where you may have locked
> yourself out in some way that caused the
> What that is, is for you to know - you haven't posted any playbook.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/66b79253-a8e1-4d03-8034-109ad4ac4999n%40googlegroups.com.

Reply via email to