Description: A stackable multienvironment directory layout for Ansible using unionfs. Check this Github project with demo data for the environments
There are three methods to run unionfs binary. From unionfs binary in the host, a docker container or a podman container.
Using unionfs host binary
- unionfs-fuse
Using docker engine
- Docker
- Docker SDK for Python
Using podman engine
-
Podman
-
See
requirements.txt
Define a stackable environment hierarchy in multienv_union variable using a list. The last environment in the list has the most priority. For example dev:
multienv_union:
- base
- devFor example dev:
multienv_union:
- base
- productionMore than two directories can be stacked. For example, to stack stage over dev and base:
multienv_union:
- base
- dev
- stageFor the rest of variables:
- See
defaults/main.yml.
- Centos: if using Centos and getting a message like 'is mounted on / but it is not a shared mount', you may need to make
multienv_host_mountpointa shared mount point withmount --make-rshared <multienv_host_mountpoint>. Replace<multienv_host_mountpoint>with the respective value - Depends on other Ansible roles: no
- hosts: all
roles:
- jobcespedes.multienvRun it with docker:
ansible-playbook -i localhost, multienv.ymlRun it with podman:
# podman method requires sudo
ansible-playbook -i localhost, multienv.yml -e multienv_method=podman -KRun it with binary in host:
ansible-playbook -i localhost, multienv.yml -e multienv_method=binaryUnmount it
ansible-playbook -i localhost, multienv.yml -e multienv_stop=trueApache 2.0
Job Céspedes: jobcespedes@gmail.com