I’m trying to deploy specific Java EE EARs to a host based on what groups that host is in.
Each EAR goes in to it’s own deployable directory because we’re running each application component in it’s own container.
What I have is:
- name: Copy EAR
copy:
src: “{{ maven }}/au/com/company/{{ item.1.name }}/{{ item.1.version }}/{{ item.1.name }}-{{ item.1.version }}.ear”
dest: /opt/company/{{ item.0.name }}/deployments/{{ item.1.name }}.ear
with_subelements: - deployables
- ears
when: item.0.name in group_names
with the variables file containing:
maven: “{{ lookup(‘env’, ‘HOME’) }}/.m2/repository”
deployables:
- application: catalogue
ears: - { name: ‘catalogue-ear’, version: ‘0.2.0-SNAPSHOT’ }
which gives the error:
fatal: [local-int] => error while evaluating conditional: item.0.name in group_names
What I had hoped would happen is if this host is in the catalogue group then the catalogue EAR would be copied in to the specified directory.
Is the ‘in’ operator not supported here, or am I missing something really obvious? Is there a better way to do this?
Thanks,
Lyle