Project Description: I have a project that uses Docker Swarm to create an infrastructure for a distributed application to run on. That application is composed of Python and bash files (everything is Linux oriented). To bootstrap this whole project, I'm using Ansible to build the containers, push files around, and verify environments on each target Swarm node.
Problem: Because this is an application I'm trying to make (relatively) user friendly for tech savvy type people, I'd like to have just one configuration file they can fill out. But I'm a little stuck on how to then take these values (some of which are inter-dependent across Bash/Python/Docker) and actually fill in the real values.
What's the best way to approach this? I've been considering making a few Python parsers that Ansible kicks off to fill in everything, but I've been reluctant to jump on that.
Python, Docker and Ansible all have, at minimum, read access to the environment. export
your variables from Bash, then access them independently from each application. I would put serious effort into minimizing interdependence, since I don't know that you can write to the environment from these applications.
edit:
Bash does not support env
ironmental arrays, but, rather than clog up your environment with many related variables, you can export delimited strings:
export my_string='key=value:user=Bob:multiple_keys=one,two,three'
This is an exercise in good planning and documentation. Think carefully about how this string will grow as your script develops.
See $ env |awk '/^(PATH|LS_COLORS)=/' ORS=\\n\\n
for two native examples of delimited strings.