I have below playbook:

i have put a loop, there are 8 aggr and 4 protocols: this playbook output 
is like after every 4 loop, it increments aggr and protocols. 

output of the playbook is:

svm1,svm2,svm3,svm4---aggr1 and nfs
svm5,svm6,svm7,svm8---aggr2 and iscsi
svm9,svm10,svm11,svm12---aggr3 and cifs
svm13,svm14,svm15,svm16---aggr4 and fcp

currently the ansible is failing because after 16th loop it is not finding 
any protocols.

but after 16th loop i want protcols to repeat :

expecting ouput:

svm17,svm18,svm19,svm20---aggr5 and nfs
svm21,svm22,svm23,svm24---aggr6 and iscsi
svm25,svm26,svm27,svm28---aggr7 and cifs
svm29,svm30,svm31,svm32---aggr8 and fcp



- hosts: localhost
  gather_facts: false
  vars_files:
    - /etc/ansible/group_vars/host_vars

  vars:
    aggr:
      - aggr_1
      - aggr_2
      - aggr_3
      - aggr_4
      - aggr_5
      - aggr_6
      - aggr_7
      - aggr_8
    protocols:
      - nfs
      - iscsi
      - cifs
      - fcp
  tasks:
    - name: Create SVM
      na_ontap_svm:
        state: present
        name: "svm{{ item }}"
        root_volume: "svm{{ item }}_root_vol"
        root_volume_aggregate: "{{ aggr[((item|int-1)//4)] }}"
        allowed_protocols: "{{ protocols[(((item)|int-1)//4)] }}"
        root_volume_security_style: mixed
        hostname: "{{ aiqumip }}"
        username: "{{ aiqumusername }}"
        password: "{{ aiqumpassword }}"
        https: false
      with_sequence: start=1 end=32

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f5197c02-a323-41f0-8e9b-d058a53e67ee%40googlegroups.com.

Reply via email to