I have 2 roles, ansible-certbot and ansible-rutorrent.
ansible-rutorrent depends on ansible-certbot:
`
dependencies:
- role: “rahul0705.rtorrent”
- role: “rahul0705.apache”
- role: “rahul0705.ansible-certbot”
certbot_cert_domain: “{{ rutorrent_server_name }}”
certbot_cert_email: “{{ rutorrent_server_admin }}”
when: rutorrent_ssl_set
`
As can be seen, I am overriding variable in the certbot role.
Within the ansible-rutorrent role, we use the variables in ansible-certbot in our defaults:
`
rutorrent_ssl_certificate_name: fullchain.pem
rutorrent_ssl_certificate_key_name: privkey.pem
rutorrent_ssl_certificate_file: “{{ certbot_cert_directory }}/{{ rutorrent_ssl_certificate_name }}”
rutorrent_ssl_certificate_key_file: “{{ certbot_cert_directory }}/{{ rutorrent_ssl_certificate_key_name }}”
`
The expected result of running this should be that when the ansible-certbot role is run (because of the dependency) the domain being used is defined from the variable of rutorrent. This DOES happen. The next expected result would be that the variable in ansible-rutorrent that reference ansible-certbot should use those new variables. This DOES NOT happen.
For completion I will show you the variables in ansible-certbot:
`
certbot_cert_domain: www.example.com
certbot_cert_email: admin@example.com
certbot_directory: /etc/letsencrypt
certbot_cert_directory: “{{ certbot_directory }}/live/{{ certbot_cert_domain }}”
`
What we see is when certbot runs it uses the correct variables, when rutorrent runs it uses www.example.com:
`
TASK [rahul0705.ansible-certbot : list variable data] ******************************************************************************
ok: [test] => {
“certbot_cert_directory”: “/etc/letsencrypt/live/rutorrent.test.com”
}
…
…
…
TASK [rahul0705.rutorrent : list var info] *****************************************************************************************
ok: [test] => (item=certbot_cert_directory) => {
“certbot_cert_directory”: “/etc/letsencrypt/live/www.example.com”,
“item”: “certbot_cert_directory”
}
ok: [test] => (item=certbot_cert_domain) => {
“certbot_cert_domain”: “www.example.com”,
“item”: “certbot_cert_domain”
}
ok: [test] => (item=certbot_cert_email) => {
“certbot_cert_email”: “admin@example.com”,
“item”: “certbot_cert_email”
}
`
Any help here would be greatly appreciated.