i have this ansible structure its part of large codebase :
it seems that when running the main playbook the defaults/main.yml
app_type:game
don't pass on to the current_version.yml and give error
why it doesn't use the default var in defaults/main.yml
also when i pass the same variable name from --extra-vars it gives me the
same error
when i print the variable from tasks/main.yml
it prints the right value
what is wrong with the include_role?
C:.
├───defaults
│ main.yml
│
└───tasks
main.yml
current_version.yml
legacy_version.yml
main.yml
---
app_type: game
tasks/main.yml
#- name: set lagacy_package true
# set_fact:
# lagacy_package: true
- name: select legacy
include_role:
tasks_from: legacy_version
name: package_install
public: true
vars:
app_type: "{{ app_type }}"
when: (lagacy_package is defined) and (lagacy_package == true)
- name: select Current
include_role:
tasks_from: current_version
name: package_install
public: true
vars:
app_type: "{{ app_type }}"
when: lagacy_package is not defined
current_version.yml
- debug:
msg: "System 2 ################ {{ app_type }}
######################################## "
error from current_version.yml
2020-07-01 17:04:09,118 p=11546 u=ec2-user n=ansible | fatal: [10.0.5.71]:
FAILED! =>
msg: 'An unhandled exception occurred while templating ''{{ app_type
}}''. Error was a <class ''ansible.errors.AnsibleError''>, original
message: An unhandled exception occurred while templating ''{{ app_type
}}''. Error was a <class ''ansible.errors.AnsibleError''>, original
message: An unhandled exception occurred while templating ''{{ app_type
}}''. Error was a <class ''ansible.errors.AnsibleError''>, original
message: An unhandled exception occurred while templating ''{{ app_type
}}''. Error was a <class ''ansible.errors.AnsibleError''>, original
message: An unhandled exception occurred while templating ''{{ app_type
}}''. Error was a <class ''ansible.errors.An
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ae46209f-7bc3-49bc-838e-46b0355459f5o%40googlegroups.com.