Thornid
Jul 24, 2020Nimbostratus
Basic Question on Ansible - Creating Nodes
Hello all
I know this is basic but I'm starting off learning about Ansible and F5s. I'm following this lab guide:
https://github.com/ansible/workshops/tree/devel/exercises/ansible_f5/1.2-add-node
I have configured a basic inventory as such:
[lb]
f5 ansible_host=X.X.X.X ansible_user=admin private_ip=X.X.X.X ansible_ssh_pass=XXXXXXXX
[webservers]
host1 ansible_host=X.X.X.X
host2 ansible_host=X.X.X.X
I then have my YAML file as follows:
---
- name: BIG-IP SETUP
hosts: lb
connection: local
gather_facts: false
tasks:
- name: CREATE NODES
bigip_node:
provider:
server: X.X.X.X
user: XXXX
password: XXXXXXX
server_port: 443
validate_certs: false
host: "{{hostvars[webservers].ansible_host}}"
name: "{{hostvars[webservers].inventory_hostname}}"
loop: "{{ groups[webservers] }}"
When I try to run this playbook I get the following error:
devlin@ubuntu-v20:~/ansible/f5/lab2$ ansible-playbook -i inventory bigip-node.yaml
PLAY [BIG-IP SETUP] *****************************************************************************************************************
TASK [CREATE NODES] *****************************************************************************************************************
fatal: [f5]: FAILED! => {"msg": "'webservers' is undefined"}
PLAY RECAP **************************************************************************************************************************
f5 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
What does it mean "webservers is undefined"?
Thank you?