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
[email protected] schrieb am Mittwoch, 12. Januar 2022 um 23:30:09 UTC+1:
> In your ansible-playbook command it references the tag "basic" but the
> playbook itself references "basics". Could you update and try again?
>
> On Wed, Jan 12, 2022, 3:21 PM 'Alex D.' via Ansible Project <
> [email protected]> wrote:
>
>> 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:
>> ~
>> [WARNING]: Could not match supplied host pattern, ignoring:
>> dynamically_created_hosts
>>
>> PLAY [Initialize selected VRF NMS]
>> ***********************************************************************************************************************************************************************************************************
>> skipping: no hosts matched
>>
>> When i use --skip-tags, it works as expected. I wonder if running
>> ansible-playbooks with tags included is even supported ?
>>
>> *init-vrf-nms.yml *
>> ---
>> - hosts: localhost
>> gather_facts: no
>>
>> vars_prompt:
>> - name: nms
>> prompt: Which VRF NMS should be initialized
>> private: no
>>
>> tasks:
>> - name: "Add host to dynamic inventory"
>> add_host:
>> name: "{{ nms }}"
>> groups: dynamically_created_hosts
>>
>> # ---------------------------------------------------------
>>
>> - name: "Initialize selected VRF NMS"
>> hosts: dynamically_created_hosts
>> become: yes
>>
>> tasks:
>>
>> - name: "Apply role 'nms-basic'"
>> include_role:
>> name: nms-basics
>> tags:
>> - basics
>>
>> - name: "Apply role 'vrf-vm'"
>> include_role:
>> name: vrf-vm
>> tags:
>> - vrf-vm
>>
>> Regards,
>> Alex
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/47b900b9-df78-4ecd-8168-eb1d49b11da6n%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/47b900b9-df78-4ecd-8168-eb1d49b11da6n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/bf26616d-fd70-4271-8c73-7909b0e01ac4n%40googlegroups.com.