--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6ff2a7d1-df01-456d-ab33-80bf5151bb26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Not sure how others do it, but I have vars files called e.g. project_dev.yaml, project_prod.yaml. I load these where needed via include_vars, specifying the file as e.g. "project_{{ env }}.yaml"Then I specify the environment on the command line using -e, e.g. "-e env=prod"This has the added advantage of preventing the playbook from running at all if I forget the env variable or if I provide one that doesn't having a matching vars file.Plus you can (if you want to) refer to the "env" variable in conditions.Regards, K.
On Fri, Jul 20, 2018 at 7:04 AM, java_cat33 <ltd...@gmail.com> wrote:
Due to a lot of complexities we currently clone our prod systems into a dev and test environment (each environment is completely isolated). I've got Ansible running currently in the dev environment where I've built a bunch of plays.We're about to deploy the changes made in the dev environment to the test environment - will need to build a new Ansible box - this will have access to the same source control for where the current plays are stored for the dev environment.The hostnames and IP's are identical in dev/test and prod (for this project).In one of the playbooks I need to use the win_lineinfile module to insert/replace a line of code in a web.config file - the code that needs to be inserted I want based upon an environment variable (dev, test or prod) so this play can be used in dev/stage and prod. Each environment would need a different section of code in the web.config file.E.G dev = devintegration.server.exampletest = testintegration.server.exampleI'm not too sure on how to go about this....I'm currently running the plays manually - but my next step is to then build projects and run them via AWX.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6ff2a7d1-df01-456d-ab33-80bf5151bb26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0afa4513-0d3e-4843-a205-1f25dbdf60c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0afa4513-0d3e-4843-a205-1f25dbdf60c1%40googlegroups.com.
# dev inventory
[appservers]
host3
host4
[dbservers]
host5
host6
[webservers]
host1
host2
# add host groups to environment-specific group for dev
[dev_group:children]
appservers
dbservers
webservers
## end of dev inventory# test inventory
[appservers]
host3
host4
[dbservers]
host5
host6
[webservers]
host1
host2
# add host groups to environment-specific group for test environment
[test_group:children]
appservers
dbservers
webservers
# end of test inventory---
endpoint_server: devintegration.server.example
---
endpoint_server: testintegration.server.example
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7f925b52-dd7d-45a2-bfd0-89ec4f6d33a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7f925b52-dd7d-45a2-bfd0-89ec4f6d33a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3b897bfc-6de6-4eaa-a9b7-ca4404880993%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3b897bfc-6de6-4eaa-a9b7-ca4404880993%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0ee51777-59c7-427b-96ce-e9367e6853d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.