We are use AWX for configuration managment and our team has a lot of playbooks and 4 enviroment scopes (DEV, QA, STAGING, PRODUCTION). In our playbooks we are use some specific variable in ansible.cfg that allows us send notifications.
[some_section]
some_var = https://some-dev-url/service/job_complete?
On dev env he looks like example above, on qa, we add qa in link, on prod, we add prod in link etc. When we push code beetwen branches example: dev -> qa, we always have a confilct, because link in ansible.cfg doesnt match. What we are doing now, is the always change this link when we merged something. What im trying to do, is the pass with ansible extra vars(in ansible.cfg) this link, when playbook runs, but unforthunatly, i dont have a success. The only thing that happened was I pulled the variable out of the config, but I do not know what to do next.
- name: SOME LINK
debug:
msg: "{{ lookup('ini', 'some_var section=some_section file=ansible.cfg') }}"
OK: "msg": "https://some-dev-url/service/job_complete?"
It only occurs to rewrite the config somehow with a bash script when the playbook is started. If someone has a solution, please) (by the way, we tried to use git ignore on this file, it doesn’t work)