Ansible run from Satellite: delegate_to doesn't work
Hello, I'm using Red Hat Satellite 6.12.4.
I need to run the Ansible playbook on a remote server except for one task that I need to run locally on a Satellite server. I tried delegate_to, but it doesn't work.
How can I do it?
My playbook:
---
- hosts: all
gather_facts: True
tasks:
- name: get server fqdn
set_fact:
server_fqdn: "{{ ansible_fqdn }}"
- name: satellite server fqdn
set_fact:
satellite_fqdn: "{{ ansible_fqdn }}"
delegate_to: satellite.example.net
- name: print fqdn
debug:
msg: "SERVER={{ server_fqdn }} SATELLITE={{ satellite_fqdn }}"
and the output:
TASK [print fqdn] **************************************************************
ok: [test.example.net] => {
"msg": "SERVER=test.example.net SATELLITE=test.example.net"
}