earlier I have these condition on my ansible task.yml which I verified working, basically when the parameter is dev
then the ASG
is set to "awseb-e-xxxxxxxxxxxxxxx-stack-AWSEBAutoScalingGroup-DEV
", if not then ASG will be set to the uat
ASG
which is "awseb-e-xxxxxxxxxxxxxxx-stack-AWSEBAutoScalingGroup-UAT
"
- set_fact:
ASG: "{{ (env == 'dev') | ternary('awseb-e-xxxxxxxxxxxxxxj-stack-AWSEBAutoScalingGroup-DEV', 'awseb-e-xxxxxxxxxxxxxxj-stack-AWSEBAutoScalingGroup-UAT') }}"
My question is what if I add more choice on the logic, say when the parameter used on the playbook is prod
then use the ASG
"awseb-e-xxxxxxxxxxxxxxj-stack-AWSEBAutoScalingGroup-PROD
"? I have this idea but not sure if it will work, let me know your expert advices
- set_fact:
ASG: "{{ (env == 'dev') | ternary('awseb-e-xxxxxxxxxxxxxxj-stack-AWSEBAutoScalingGroup-DEV'}}"
- set_fact:
ASG: "{{ (env == 'uat') | ternary('awseb-e-xxxxxxxxxxxxxxj-stack-AWSEBAutoScalingGroup-UAT'}}"
- set_fact:
ASG: "{{ (env == 'prod') | ternary('awseb-e-xxxxxxxxxxxxxxj-stack-AWSEBAutoScalingGroup-PROD'}}"