0

Team, I have two vars that map to two environments. I want to use them in playbook but only one value should be applied based on env playbook runs on.

ex:

var = test1 > should be loaded when env1
var = test2 > should be loaded when env2

any hint how can i achieve this in ansible?

I want to write my task in such a way that this variables var carries test1 value when it is run on env1 and vice versa. is there a login I can use at task level? my task is below and when am running my playbook on clusterA it should use var=test1 and when running on clusterB it should use var=test2

    - name: Add persistent ddn volume
  mount:
    path: "{{ lustre_client_path }}"
    src: "{{ var }}"
    fstype: lustre
    state: mounted
1

1 Answer 1

-1

Actually I figured out. I just had to create a separate file and called it configs.yml and place it in each cluster env playbook directly. This worked. So based on env is now loading.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .