Hi,
I tried to run a playbook with a dynamic inventory (see my playbook below) using e.g. ansible-playbook -i nms-vms init-vrf-nms.yml --extra-vars “nms=nms-sz” --tags=basic
Unfortunately, i got the following error:
Hi,
I tried to run a playbook with a dynamic inventory (see my playbook below) using e.g. ansible-playbook -i nms-vms init-vrf-nms.yml --extra-vars “nms=nms-sz” --tags=basic
Unfortunately, i got the following error:
show output of `ansible-inventory -i nms-vms --list`
Here’s the output. Some vars are obfuscated
$ ansible-inventory -i nms-vms --list
{
“_meta”: {
“hostvars”: {
“nms-sz”: {
“Files”: ,
“ansible_become_method”: “sudo”,
“ansible_common_remote_group”: “sysadmins”,
“ansible_host”: “172.28.x.x”,
“ansible_password”: “xxx”,
“ansible_ssh_common_args”: “-o StrictHostKeyChecking=no”,
“ansible_sudo_pass”: “xxx”,
“ansible_user”: “xxx”,
“mrtg”: {
“sample_dir”: “sz”,
“sample_router”: “sz-r1.4711”
},
“netplan”: {
“ens160”: {
“ipv4”: {
“address”: “172.28.x.x”,
“gateway”: “172.28.x.x”,
“netmask”: “255.255.255.128”,
“prefix_length”: 25
}
},
“ens192”: {
“ipv4”: {
“address”: “192.168.x.x”,
“netmask”: “255.255.x.x”,
“prefix_length”: 30,
“routes”: [
{
“to”: “192.168.250.0/24”,
“via”: “192.168.x.x”
},
{
“to”: “172.30.95.22/32”,
“via”: “192.168.x.x”
}
]
}
}
},
“network_gear”: {
“access”: [
“ssh”,
“telnet”
],
“snmp_community”: “xxx”
},
“nginx”: {
“enabled”: false,
“state”: “stopped”
},
“rancid_groups”: [
“sz”
],
“rancid_user”: “xxx”,
“rancid_user_pass”: “xxx”,
“syslog_facilities”: [
“local7”
]
}
}
},
“all”: {
“children”: [
“ungrouped”,
“vrf_nms”
]
},
“vrf_nms”: {
“hosts”: [
“nms-sz”
]
}
}
In your ansible-playbook command it references the tag “basic” but the playbook itself references “basics”. Could you update and try again?
Sorry, that was just an error while cut&paste in my first post.
$ ansible-playbook -i nms-vms init-vrf-nms.yml --check --diff --extra-vars “nms=nms-sz” --tags=basics
PLAY [localhost] *****************************************************************************************************************************************************************************************************************************
[WARNING]: Could not match supplied host pattern, ignoring: dynamically_created_hosts
PLAY [Initialize selected VRF NMS] ***********************************************************************************************************************************************************************************************************
skipping: no hosts matched
PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
What makes me suspicious is the message “Could not match supplied host pattern, ignoring: dynamically_created_hosts”
$ ansible-playbook -i nms-vms init-vrf-nms.yml --extra-vars “nms=nms-sz” --list-tags
[WARNING]: Could not match supplied host pattern, ignoring: dynamically_created_hosts
playbook: init-vrf-nms.yml
play #1 (localhost): localhost TAGS:
TASK TAGS:
play #2 (dynamically_created_hosts): Initialize selected VRF NMS TAGS:
TASK TAGS: [basics, vrf-vm]
Regards,
Alex