---
- name: Check the apps list in ArgoCD server with related to cluster:"{{clustername.stdout}}"
shell: |
argocd app list | grep {{clusterip.stdout}} | grep {{proj_name}} | awk '{print $1}'
register: applist
- debug:
var: applist.stdout_lines
- name: Create xedge apps to production ns
shell: |
argocd app create {{item}}-{{app_extention}} --project {{proj_name}} --repo {{gitops_url}} --revision HEAD --values {{values_file}}.yaml --path {{item}} --dest-namespace production --label app={{item}} --dest-server {{clusterip.stdout}}
with_items:
- "{{production_apps}}"
#skip apps creation if apps are already existed
when : "item-app_extention not in applist.stdout_lines"
'' error: fatal: [localhost]: FAILED! => {"msg": "The conditional check 'item-app_extention not in applist.stdout_lines' failed. The error was: Unexpected templating type error occurred on ({% if item-app_extention not in applist.stdout_lines %} True {% else %} False {% endif %}): unsupported operand type(s) for -: 'AnsibleUnsafeText' and 'AnsibleUnicode'\n\nThe error appears to be in '/etc/ansible/roles/xedge/tasks/argocd_apps.yml': line 8, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n var: applist.stdout_lines\n- name: Create xedge apps to production ns\n ^ here\n"}
''