Is there a way to apply dot notation against the ‘environment_id’ variable so that I do it once and not have to apply it multiple times within my file? What I really want is the value after I “grep” for the last two character in the string (see debug statement).
- name: Get environment idset_fact:
environment_id: “{{ lookup(‘ini’,‘environment section=multidb file=xyz.conf’) }}”
- debug: msg={{ environment_id[-2:] }}
- name: Build list of modules
set_fact:
deploy_list: “{{ item | replace(‘deploys/’ + environment_id + ‘/’,‘’) }}-{{ lookup(‘consul_kv’,‘deploys/’ + environment_id + ‘/’ + item) }}”
with_items: “{{ modules }}”
register: deploy_list_result