#ansible (2023-09)
Discussions related to ansible configuration management
2023-09-05
![jonjitsu avatar](https://secure.gravatar.com/avatar/8d4169f1a7fd27bd9a11a25ccfed62c8.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0014-72.png)
Anyone have any recommendations for roles for java & tomcat?
![Hao Wang avatar](https://secure.gravatar.com/avatar/aa01de6ab42f1576bbb56a203c660939.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0013-72.png)
This looks an active one, https://galaxy.ansible.com/robertdebock/tomcat
Jump start your automation project with great content from the Ansible community
![jonjitsu avatar](https://secure.gravatar.com/avatar/8d4169f1a7fd27bd9a11a25ccfed62c8.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0014-72.png)
Thanks, have you used it? I was looking more for opinions based on personal experience.
![Hao Wang avatar](https://secure.gravatar.com/avatar/aa01de6ab42f1576bbb56a203c660939.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0013-72.png)
I used one of tomcat playbooks but not sure if this is the one. Ansible is easy to work with, and you can also take a look into their codes
2023-09-06
2023-09-15
![ikar avatar](https://avatars.slack-edge.com/2019-12-12/872745210438_a9cbe68481dd0d2b9e3d_72.jpg)
Hey all, few weeks ago we decided to use AWS profiles (not to use the default one) but I’m not sure how to set profile (and region) in ansible.
There is no such configuration in ansible.cfg (https://docs.ansible.com/ansible/latest/reference_appendices/config.html). So instead of this:
- debug: var="{{ lookup('amazon.aws.aws_secret', 'redis/access') }}"
we have to do this:
- debug: var="{{ lookup('amazon.aws.aws_secret', 'redis/access', profile='xxx', region='eu-central-1') }}"
which is annoying.
As a workaround we can use environmental variables (AWS_PROFILE
and AWS_REGION
) but setting it globally or prepending to every ansible-playbook call is not ideal.
is there a way ho to set environmental variables in ansible.cfg or ansible in general
![ikar avatar](https://avatars.slack-edge.com/2019-12-12/872745210438_a9cbe68481dd0d2b9e3d_72.jpg)
Thanks @bradym, not exactly what I was looking for. I’d have to set variables in each playbook. Something like ChatGTP suggests would be great, but it seems it doesn’t work that way:
![bradym avatar](https://avatars.slack-edge.com/2023-06-21/5464816405572_dd21bed1bf537acb6539_72.jpg)
Yeah, ChatGPT does tend to make stuff up
![bradym avatar](https://avatars.slack-edge.com/2023-06-21/5464816405572_dd21bed1bf537acb6539_72.jpg)
Another option would be to use group variables that you set in your inventory. https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#adding-variables-to-inventory
![ikar avatar](https://avatars.slack-edge.com/2019-12-12/872745210438_a9cbe68481dd0d2b9e3d_72.jpg)
Yeah, thanks, we use that too…
But I actually need to set the env vars for the control machine per infra repository. Basically the ansible.cfg
would be ideal place for that, but there seems to be no support for that
Maybe I’ll just have to source some env.sh file before each playbook run
![bradym avatar](https://avatars.slack-edge.com/2023-06-21/5464816405572_dd21bed1bf537acb6539_72.jpg)
If they are separate folders/repos you could use https://direnv.net/ to automatically set env vars when switching into the folder. For an automated job you’d just source the .envrc file first
unclutter your .profile
![ikar avatar](https://avatars.slack-edge.com/2019-12-12/872745210438_a9cbe68481dd0d2b9e3d_72.jpg)
perfect! thanks