Let me start this out by saying that this playbook I’m referencing is running on a 3-node Ansible Tower installation. Before anyone says "contact Red Hat’, this question is a base Ansible question, and something that would fall outside of the Red Hat Ansible Tower support chain.
In my playbook, I generate a file on serverA that I want to make sure ends up on Ansible nodeA. Since this is a playbook that could run on any one of 3 servers since its a cluster (nodeA, nodeB, nodeC), using the fetch module could put the file on any one of those 3. So I need to know how to either: 1) specify nodeA specifically when copying the file, or 2) be able to retrieve the execution node and use that.
I was able to get this to work by creating a new Instance Group in Ansible Tower that had the nodeA ansible node as its only member, then assigned this group to the playbook (called a Template in Ansible Tower) which essentially guaranteed that the playbook would always run on that node. Then everything worked as expected.
Let me start this out by saying that this playbook I'm referencing is running on a 3-node Ansible Tower installation.
Before anyone says "contact Red Hat', this question is a base Ansible question, and something that would fall outside of
the Red Hat Ansible Tower support chain.
In my playbook, I generate a file on serverA that I want to make sure ends up on Ansible nodeA. Since this is a
playbook that could run on any one of 3 servers since its a cluster (nodeA, nodeB, nodeC), using the fetch module could
put the file on any one of those 3. So I need to know how to either: 1) specify nodeA specifically when copying the
file, or 2) be able to retrieve the execution node and use that.
Here's the section of my playbook in question:
---
- hosts: serverA
tasks:
- name: Write results to file
copy:
content: " Test message "
dest: /home/user1/test.txt
owner: user1
group: user1
I accidentally added that instead of the name of the source file. The source file is created ahead of that using the copy module and the content property. Sorry for the confusion.