Forum Discussion

ml4den_387195's avatar
ml4den_387195
Icon for Nimbostratus rankNimbostratus
Mar 29, 2019

How to add members to a pool with Ansible?

Hello, I am trying to follow the F5 playbook tutorial here. However, I get strange errors when I try to add members to my poool. This is my playbook:

---

- name: Create a pool and pool members
  hosts: f5lab
  connection: local

  vars:
   provider:
    server: "{{ inventory_hostname }}"
    password: "secret"
    user: "adminuser"
    validate_certs: no

  tasks:

   - name: Create a Pool
     bigip_pool:
      provider: "{{ provider }}"
      name: web
      monitors: "/Common/http"
      lb_method: round-robin
     delegate_to: localhost

   - name: Add members to pool
     bigip_pool_member:
      provider: "{{ provider }}"
      description: "webserver {{ item.name }}"
      host: "{{ item.host }}"
      name: "{{ item.name }}"
      pool: web
      port: 80
     with_items:
      - host: 10.10.10.10
        name: "webserver-1"
      - host: 10.10.20.10
        name: "webserver-2"
     delegate_to: localhost

These are the errors:

failed: [cam-adclab -> localhost] (item={u'host': u'10.10.10.10', u'name': u'webserver-1'}) => {"changed": false, "item": {"host": "10.10.10.10", "name": "webserver-1"}, "msg": "received exception: "}
failed: [che-adclab -> localhost] (item={u'host': u'10.10.10.10', u'name': u'webserver-1'}) => {"changed": false, "item": {"host": "10.10.10.10", "name": "webserver-1"}, "msg": "received exception: "}
failed: [che-adclab -> localhost] (item={u'host': u'10.10.20.10', u'name': u'webserver-2'}) => {"changed": false, "item": {"host": "10.10.20.10", "name": "webserver-2"}, "msg": "received exception: "}
failed: [cam-adclab -> localhost] (item={u'host': u'10.10.20.10', u'name': u'webserver-2'}) => {"changed": false, "item": {"host": "10.10.20.10", "name": "webserver-2"}, "msg": "received exception: "}

These are fake details but the result is the same with real web servers and IP addresses that are resolvable. It shouldn't have to resolve anything as we are trying to add the nodes by IP and give them an arbitrary name.

Speaking of resolution, if I try to add a node by "fqdn" as opposed to "address" ("host"), it complains that this is not a supported argument, which is a contradiction to what the documentation says.

Can anyone help me add the pool members, even if it's by IP like the tutorial suggests please?

1 Reply

  • You may want to ensure your F5 module and Ansible is up to date. I ran your playbook without error on my lab machine.