Posted on
Hey Dorota, using ansible to get repeatable deployments in dev/staging/production with each environment beeing as similar as possible to one another is what I mostly use it for, and I have been quite happy with it. The way I do it is as follows: Don't target specific hosts in your playbook but only host groups. Then have different inventory files for each environment that define which host(s) actually belong to the group, switching out hosts for each environment. This way I can simply do: ’’’ ansible-playbook setup-websites.yaml -i development.ini ansible-playbook setup-websites.yaml -i staging.ini ansible-playbook setup-websites.yaml -i production.ini ’’’ All settings for the playbook's roles live nicely in ’group_vars/host_group_name/role_name.yaml’ , and only if I really need something to be different in one environment, I can use ’host_vars/production_host_name/role_name.yaml’ to override the variables I need to change. I can't remember were i read about the practice (probably Ansible for Devops by Jeff Geerling). also Elixir seems fun, I have been wanting to build a side project with it for some time :) Cheers Florian Z