'Ansible playbook with environment variable [duplicate]
I trying to setup a gitlab pipeline to create a rabbitmq standalone machine, and i use rockandska/ansible-role-rabbitmq to do this. But in defaults/main.yaml e need to create some users with password, but i dont want to commit passwords in my git repo. So i need to get pass values from gitlab ci/cd environments variables.
But i'm not getting this, i trying to create a file in
vars/main.yml
---
rabbitmq_admin_pass: ${RABBITMQ_PASSWORD}
and in defaults/main.yml i use
rabbitmq_users_to_create:
- user: admin
password: "{{ rabbitmq_admin_pass }}"
vhost: /
configure_priv: .*
read_priv: .*
write_priv: .*
tags: administrator
but doesn't work, it creates the user but with "${RABBITMQ_PASSWORD}" pass :D
ps. I already put in .gitlab-ci.yml variables directive, like that:
variables:
ANSIBLE_BECOME_PASSWORD: ${ANSIBLE_BECOME_PASSWORD}
RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD}
someone have some idea to do this?
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
