arraysansibleansible-awxbig-ip

Ansible array in one task


I have a problem with ansible array's.

I have a task like this:

  tasks:   
  - name: create member and add to pool 
    bigip_pool_member:
      pool: "{{pool_name}}"
      partition: "{{partition}}"
      host: "{{ip}}"
      name: "{{ip}}"
      port: "{{port}}"
      monitors:
        - "{{item}}"
      loop: "{{monitor}}"
      description: "{{description_member}}" 
      provider:
               ####

And I want to add multiple monitors to the pool. Only it does not work. I need to do this in one task. How do I do this?


Solution

  • The loop will run the task multiple times. It looks like you should be simply giving the array to the task directly:

      - name: create member and add to pool 
        bigip_pool_member:
          pool: "{{pool_name}}"
          partition: "{{partition}}"
          host: "{{ip}}"
          name: "{{ip}}"
          port: "{{port}}"
          monitors: "{{monitor}}"
          description: "{{description_member}}"