when leveraging tags in Ansible I need to use import_role so the tags propagate through the role. However, when you use import_role only the first declaration of atc_declaration_files is used for all subsequent calls. Example below of a subsequent call where the atc_declaration_file is still using the value from the first call (not show).
`- name: Prepare the AS3 Juice Shop application declaration from the template
template:
src: "{{ role_path }}/templates/{{ as3_juiceshop_template }}"
dest: "{{ tmp_dir }}/{{ as3_juiceshop_declaration }}"
name: set AS3 Juice Shop Destination
set_fact:
as3_juice_shop: "{{ tmp_dir }}/{{ as3_juiceshop_declaration }}"
debug: var=as3_juice_shop
name: Deploy the Juice Shop app service configuration
import_role:
name: f5devcentral.atc_deploy
vars:
atc_service: AS3
atc_method: POST
atc_declaration_file: "{{ as3_juice_shop }}"
atc_delay: 10
atc_retries: 5
provider: "{{ bigip_provider }}"
when leveraging tags in Ansible I need to use import_role so the tags propagate through the role. However, when you use import_role only the first declaration of atc_declaration_files is used for all subsequent calls. Example below of a subsequent call where the atc_declaration_file is still using the value from the first call (not show).
`- name: Prepare the AS3 Juice Shop application declaration from the template template: src: "{{ role_path }}/templates/{{ as3_juiceshop_template }}" dest: "{{ tmp_dir }}/{{ as3_juiceshop_declaration }}"
name: set AS3 Juice Shop Destination set_fact: as3_juice_shop: "{{ tmp_dir }}/{{ as3_juiceshop_declaration }}"
debug: var=as3_juice_shop
name: Deploy the Juice Shop app service configuration import_role: name: f5devcentral.atc_deploy vars: atc_service: AS3 atc_method: POST atc_declaration_file: "{{ as3_juice_shop }}" atc_delay: 10 atc_retries: 5 provider: "{{ bigip_provider }}"
TASK [ltm : set AS3 Juice Shop Destination] **** task path: /home/azureuser/HCA/CM/roles/ltm/tasks/configure-big-ip.yml:89 ok: [hcademo-bigip-0-a3c3_fe76] => { "ansible_facts": { "as3_juice_shop": "/home/azureuser/HCA/CM/roles/ltm/files/tmp/as3-juiceshop-declaration.json" }, "changed": false } Read vars_file 'vault.yml'
TASK [ltm : debug] ***** task path: /home/azureuser/HCA/CM/roles/ltm/tasks/configure-big-ip.yml:93 ok: [hcademo-bigip-0-a3c3_fe76] => { "as3_juice_shop": "/home/azureuser/HCA/CM/roles/ltm/files/tmp/as3-juiceshop-declaration.json" } Read vars_file 'vault.yml'
TASK [f5devcentral.atc_deploy : Setup provider and varables] *** task path: /home/azureuser/HCA/CM/roles/f5devcentral.atc_deploy/tasks/main.yaml:3 ok: [hcademo-bigip-0-a3c3_fe76] => { "ansible_facts": { "atc_declaration_file": "/home/azureuser/HCA/CM/roles/ltm/files/tmp/as3-common-declaration.json", "atc_show": "base", "atc_show_hash": false, "atc_tenant": "", "provider": { "password": "xxxxxxxxxx", "server": "xxxxxxxxx", "server_port": 443, "user": "admin", "validate_certs": false } }, "changed": false }`