Problems with Ansible host definitions

Currently I am setting up a Configuration Management System via Ansible.
My playbook site.yml is built with tags so I can start the different parts of the configuration individually.
The first part of the playbook works almost fine - I can run this part via the command "ansible-playbook site.yml --tags initial_config". All machines in my host group (hosts: dmzservers:!raspberrypi) are configured as expected. However, with the exception that a machine outside the host group is also attempted to configure:
PLAY RECAP
auth.dmz.tuxme.dk          : ok=42   changed=0    unreachable=0    failed=0
backend.dmz.tuxme.dk       : ok=43   changed=1    unreachable=0    failed=0   
db.dmz.tuxme.dk            : ok=42   changed=0    unreachable=0    failed=0   
develop.dmz.tuxme.dk       : ok=42   changed=0    unreachable=0    failed=0   
gateproxy.dmz.tuxme.dk     : ok=42   changed=0    unreachable=0    failed=0   
intra.dmz.tuxme.dk         : ok=42   changed=0    unreachable=0    failed=0   
ispconf.dmz.tuxme.dk       : ok=42   changed=0    unreachable=0    failed=0   
kolab.dmz.tuxme.dk         : ok=42   changed=0    unreachable=0    failed=0   
mail.dmz.tuxme.dk          : ok=42   changed=0    unreachable=0    failed=0   
mailproxy.dmz.tuxme.dk     : ok=42   changed=1    unreachable=0    failed=0   
master.lan.tuxme.dk        : ok=0    changed=0    unreachable=0    failed=1   
mastodon.dmz.tuxme.dk      : ok=42   changed=0    unreachable=0    failed=0   
proxy.dmz.tuxme.dk         : ok=42   changed=0    unreachable=0    failed=0   
web.dmz.tuxme.dk           : ok=42   changed=0    unreachable=0    failed=0   

Open in new window


But when I want to run the next part, my base setup, things start to go more wrong. Here too, the host definition is "hosts: dmzservers:!raspberrypi", so it should be the same machines that are configured. But none of the expected machines in the host group is configured. On the other hand, the same machine that is not part of the host group is trying to configure.
PLAY RECAP 
master.lan.tuxme.dk        : ok=0    changed=0    unreachable=0    failed=1 

Open in new window

It seems that the entire list of machines to be configured has been lost. If I run the command "ansible-playbook site.yml --tags base_install -v" I get the message:

Using /etc/ansible/ansible.cfg as config file
/Users/soren/Ansible/inventories/production/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
/Users/soren/Ansible/inventories/production/hosts did not meet script requirements, check plugin documentation if this is unexpected

Open in new window

I have both tried to create the hosts file in yaml format and ini format, but the message is still the same.

I think my host definition file complies with what is described here: https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html. But something I do wrong - just can't figure out what.

My host configuration, playbook and ansible.cfg file are attached.

Happy New Year to everyone :-)
site.yml
hosts.yml
ansible.cfg
Søren SjøstrømIT-Administrator/CEOAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nociSoftware EngineerCommented:
Shouldn't it be:  (as replacement for the current dmzservers)

alldmzservers:
  dmzservers:
    hosts:
        auth.dmz.tuxme.dk:
        backend.dmz.tuxme.dk:
        db.dmz.tuxme.dk:
        develop.dmz.tuxme.dk:
        gateproxy.dmz.tuxme.dk:
        intra.dmz.tuxme.dk:
        ispconf.dmz.tuxme.dk:
        kolab.dmz.tuxme.dk:
        mail.dmz.tuxme.dk:
        mailproxy.dmz.tuxme.dk:
        mastodon.dmz.tuxme.dk:
        proxy.dmz.tuxme.dk:
        web.dmz.tuxme.dk:
  raspberrypi:
    hosts:
      tools.dmz.tuxme.dk:

Then All dmzhosts selects all hosts, dmzhosts only selects the nonraspberry pi ones...
the alldmzhosts wil also select the raspberrypi.
I'm not 100% sure though as i have no need to get ansible up & running.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.