Hello all,
I am working on a Chef and Ansible Playbook in which I would like to know if I can add a conditional if/else.
Currently, the block of code is:
- name: set any required host vars
set_fact:
ip: "{{ hostvars[inventory_hostname]['ansible_host']}}"
chef_environment: production
dc_oob: "{{ hostvars[inventory_hostname]['datacenter_oob']}}" # dc_oob: "oob-abc1230008"
run_list: "recipe[fst_base::_bootly_setup]"
provisioning_run_list: "recipe[fst_base::default],recipe[fst_apt::default],recipe[fst_base_extended::default],recipe[fst_app_provisioning_workflow::cache]"
final_run_list: "recipe[fst_base::default],recipe[fst_apt::default],recipe[fst_base_extended::default]"
vault_json: "{{ vaults_json_output.stdout | from_json }}"
But in this line:
dc_oob: "{{ hostvars[inventory_hostname]['datacenter_oob']}}" # dc_oob: "oob-abc1230008"
instead of changing this by editing the .yml file everytime, I am wondering if I can add some condition in which I get option/prompt for entering that piece of data e.g. "oob-abc1230007" or "oob-abc1230008"
Make sense?