Ansible Controller - accessing files outside of EE

I am needing to create a playbook ran from our Ansible Controller (Tower) that creates a file (it is a variable list) and have it stored on our controller so that it can be loaded by a different playbook. I tested all of my code locally on the ansible server via CLI and now that I am attempting to put it into Ansible tower, I have run into problems.

I was first thinking I could run a git module to place this file into our master Git repo but this doesn’t appear to be supported by “ansible.builtin.git”. I then attempted to use the builtin copy module to place the file inside the local linux servers /tmp folder but it appears I cannot break outside of the containerized “EE” that the playbooks run from.

Does anyone have ideas…either a way to get the file into my master and develop Git repo or how to get the containerized instance in Ansible to place my file into a local server file location and then how to get that file included into a separate playbook as included variables.

I’m stumped.

Hi @walk ,

I sound like you need to mount a folder from your controller inside the EE. I know how to do it from the CLI, it’s in ansible-navigator.yml config file. But I’ll have to lookup the documentation to find a way of doing that in the controller. I think this chapter may help: 15. Execution Environments — Automation Controller User Guide v4.5



Top of my head, you could also put your task generating this file in a role, which you could run as dependancy (whole role) or pre_task (by importing this single task from role) in your playbook.

it is a variable list

Then use ansible.builtin.include_vars module to load your vars into your play, as you might already be doing.

If this file has to be pre-generated, and/or necessarily be stored on the control node, then mounting this path into the container, as suggested by @laurent-indermuehle, might well be the way to go.

1 Like

Are you trying to store the list long term or is this part of a workflow?

If it is a latter you can use set_stats to pass to the next play.