I have below playbook which creates policy:
i have parameter called policy which has 5 values(" mirror", “vault”, “mirrorandvault”, “default”, “XDP”)
i have put with_sequence loop.
i want this policy to be created with each loop.
i tried ternary operator for 2 policies "type: “{{ (volume_item|int < 7)|ternary(‘mirror’, ‘vault’) }}” It worked.
I am not sure about how to implement for 5 policies.
- hosts: localhost
gather_facts: false
vars_files: - /etc/ansible/group_vars/host_vars
tasks:
- name: Create ONTAP/ONTAP SnapMirror
na_ontap_snapmirror:
state: present
source_volume: “{{ vserver }}vol_{{ item }}”
destination_volume: “{{ vserver }}vol_{{ item | int +15}}”
source_vserver: “{{ vserver }}”
destination_vserver: “{{ vserver }}”
schedule: hourly
policy:
max_transfer_rate: 1000
hostname: “{{ aiqumip }}”
username: “{{ aiqumusername }}”
password: “{{ aiqumpassword }}”
with_sequence: start=1 end=15