delegate_to targets server being configured
Hi,
We have automation for configuration setup. We are making Tower and Satellite be able to build RHEL9 boxes. RHEL8 boxes build just fine but the same code throws an error which is perplexing us.
The code is (I have obfuscated the bits you'd expect):
-
name: Flush handlers
meta: flush_handlers -
name: Stop SSSD
service:
name: sssd
state: stopped -
name: Flush SSSD cache # noqa 301
ignore_errors: True
command: sss_cache -E -
name: Reboot server
reboot:
msg: "Reboot initiated by Ansible For System Initial Deployment"
tags:- core_initial_deployment_reboot
-
name: Run Satellite Ansible Roles
delegate_to: satelliteserverFQDN
command: "/bin/hammer host ansible-roles play --name {{ inventory_hostname }}" -
name: Configure Default Email Recipients
delegate_to: localhost
set_fact:
notify_recipient: "{{ core_initial_deployment.notify_extra|join(',') }}" -
name: Configure Extra Email Recipients
delegate_to: localhost
when: deployment_notify is defined
set_fact:
notify_recipient: "{{ notify_recipient + ',' + deployment_notify }}" -
name: "Send Initial Deployment Complete Message To {{ deployment_notify }}"
become: True
mail:
host: emailserverFQDNhere
from: "Ansible Tower tower@domain.com"
subject: "Initial Deployment Of {{ inventory_hostname_short|upper }} Complete"
to: "{{ notify_recipient }}"
cc: 'linuxroot@domain.com'
body: "{{ lookup('template', 'deployment_notify.j2') }}"
The part failing is:
- name: Run Satellite Ansible Roles
delegate_to: satelliteserverfqdnhere
command: "/bin/hammer host ansible-roles play --name {{ inventory_hostname }}"
And the output of this section is:
TASK [initial_deployment_dev : Run Satellite Ansible Roles] ********************
fatal: [serverbeingsetupFQDN -> {{ foreman.ip }}]: FAILED! => {"changed": false, "cmd": "/bin/hammer host ansible-roles play --name serverbeingsetupFQDN", "msg": "[Errno 2] No such file or directory: b'/bin/hammer'", "rc": 2}
We can see in the logs on "serverbeingsetupFQDN" that Tower is trying to run this on "serverbeingsetupFQDN and not "satelliteserverFQDN"
Is there something amiss here. We've been head scratching for awhile now. Any assistance would be fantastic.
Thanks
-AndyW