within provisioning callback play/delegate to other host?

AWX 17.1.0
Ansible 2.9.18

using AWX and provisioning callbacks after satellite installation.

Now i try to modify an infoblox entry using the infoblox client integration for linux.

problem is, during the execution of the callback curl html header limits my play execution on AWX to the specific host. How to extend this limit in a provisioning callback? Or how to do tasks on a second host, which is not executing the callback itself, but part of the inventory?

for example.

Host: testhost.bla

satellite installation

executing curl': /usr/bin/curl -k -s --data "host_config_key=info" https://awx.bla/api/v2/job_templates/61/callback/

modify infoblox entry on infoblox.bla

TASK [delte an A record] *******************************************************fatal: [ltesthost.bla]: FAILED! => {“changed”: false, “msg”: “infoblox-client is required but does not appear to be installed. It can be installed using the command pip install infoblox-client”}

if i change my play to:

  • name: infoblox Record change
    hosts: infoblox.bla
    gather_facts: no
    vars:
    tasks:
    • name: delte an A record
      infoblox.nios_modules.nios_a_record:

Get error:

PLAY [infoblox Record change] ************************************************skipping: no hosts matched

because provisioning callback is not addressing my infoblox.bla

Set the hosts to all and delegate the task for infoblox. You won’t be able to adjust the callback limit. You could look at event driven ansible for more capabilities in handling webhooks as an alternative.

Already tried:

  - name: infoblox Record tauschen
    hosts: all # <-- Infoblox
   # connection: local
    gather_facts: no
    vars:
    tasks:
      - name: delte an A record
        infoblox.nios_modules.nios_a_record:
          name: "{{ hostvars[ansible_limit]['substringHostname']['msg'] }}"
          ipv4: "{{ hostvars[ansible_limit]['foreman']['ip'] }}"
          state: absent
          provider:
            host: infoblox.bla
            username: admin
            password: xy
            ssl_verify: no
        delegate_to: 127.0.0.1

→ error because of missing infoblox client in AWX Container.
Because Infoblox Client has to be installed on AWX for connecting.


delegate_to: infoblox.bla

→ error. No matching host, because

executing curl': /usr/bin/curl -k -s --data "host_config_key=info" https://awx.bla/api/v2/job_templates/61/callback/

limits the whole thing to testhost.bla

or what do you mean?

Create an execution environment that includes the infoblox client ( ansible-builder ). Then you can delegate_to localhost and run the infoblox.nios_modules.nios_a_record module there while it is limited from the callback. Alternatively, you can just delegate_to the necessary calls to your infoblox host.

hosts

host1
host2

[all:vars]
ansible_connection = ansible.builtin.local

playbook.yml

---
- hosts: all

  tasks:
    - name: Delegate to a host not covered by the `--limit`
      ansible.builtin.debug:
        msg: This task has been delegated
      delegate_to: host2 

command

ansible-playbook --inventory hosts --limit host1 playbook.yml

results in

% ansible-playbook --inventory hosts playbook.yml --limit host1

PLAY [all] *************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************
ok: [host1]

TASK [ansible.builtin.debug] *******************************************************************************************
ok: [host1 -> host2] => {
    "msg": "I've been delegated"
}

PLAY RECAP *************************************************************************************************************
host1                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0