I tried to trim the custom facts but it will not give me expected result. My entire code as below.
---
- name: Extarcting the Value
hosts: localhost
gather_facts: no
connection: local
vars:
app_brach: onkar-test
vars_files:
- common.yml
tasks:
- name: setting the facts
set_fact:
app_name_list: "{{ app_name_list|default([])) + [item.name] }}'
loop: "{{apps_to_deploy}}"
- name: display information
debug:
var: app_name_list
- name: resetting the fact
set_fact:
app_name_list: "{{ item | reject('search', '{{app_branch'}} | list }}"
loop: app_name_list
- name: display new list
debug:
var: app_name_list1
and my common.yml is as below.
---
apps_to_deploy:
- name: jaw-app-worker-{{app_branch}}
version: 1.0.0
- name: jaw-pat-valid-{{app_branch}}
version: 1.0.1
basically first I want to assign app_name_list with app_branch which is vriable and again need to reset app_name_list custome facts by removing app_branch variable.