I have following file that I need to source in multiple plays in a playbook.
---
- hosts: all
tasks:
- shell: source /foo/bar && export API_VER=4 && blah123
- shell: source /foo/bar && export API_VER=4 && blah456
- shell: source /foo/bar && export API_VER=4 && blah678
I am trying to find a way to avoid repeating source /foo/bar
, also note that /foo/bar
is very large file, as I cannot add individually using environments:
option as it will be tedious.
Also, I don't want to add the source file content in user profile or bashrc file. as this sourcing is used only at the time of running the playbook.
Any ideas?