A nested loop in Ansible?

Following is the playbook which only works for one variable/value. I wanted it to be able to handle several values, which means in "when:..." statement below, that "val_name" would be a array containing several volumes, and a nested loop should be loop over volumes. there is already a loop in current playbook How can I do that?

---

- hosts: localhost

   collections:

    - netapp.ontap

  name: create export-policy-rule task

  gather_facts: no

  vars_files:

    - variables.yml

  vars:

    vol_name: volume_name_1

    vserver: initialization

    export_policy: initialization

  tasks:

  - name: Info

    na_ontap_info:

      use_rest: Always

      state: info

      hostname: ""

      username: ""

      password: ""

      https: true

      validate_certs: false

      gather_subset:

        - volume_info

    register: my_ontap

  - set_fact:

      vserver: ""

      export_policy: ""

    with_items: ""

    when: my_ontap.ontap_info.volume_info[item] is search ("")


  - name: create the rule

    na_ontap_export_policy_rule:

      state: present

      policy_name: ""

      vserver: ""

      client_match: 1.1.1.0/24,1.1.2.0/24

      ro_rule: sys

      rw_rule: sys

      protocol: nfs

      super_user_security: sys

      allow_suid: true

      hostname: ""

      username: ""

      password: ""

      https: true

      validate_certs: false

  - debug:

      msg:

      - ""

      - ""


from Recent Questions - Stack Overflow https://ift.tt/3aJAqup
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation