on remembering cnames instead of hostnames

Hello all,

I was running playbooks/commands against a few select hosts at a time:

ansible-playbook update.yml -l host1:host2:host3’s_cname: …

The problem I was having here, is that the cname isn’t in the inventory, but since
I was running it against multiple hosts/groups, there isn’t a “no hosts matched”
or similar warning.

If other people would think it useful, I would propose one of:

A) Warn when no hosts match an argument from ‘–limit’

I would interpret any pattern given to --limit to be given expecting
a match (or an exclusion if “!” or “&” is used), so a warning when
some part of it does nothing would be useful.

That way, ansible all -a “echo test” -l host1:fat_finger
would warn you that you there is no fat_finger host or group.

B) Allow cname or alias names in the inventory

This would tell Ansible that I don’t really mean “host3’s cname” and would
interpret it as “host3”.

This is might be better suited for an inventory plugin.
The problem with just using "alias"s as mentioned in the docs,
would be that any other inventory variables for host3 won’t be found
at hostvars[‘host3s cname’].

Hello all,

I was running playbooks/commands against a few select hosts at a time:

ansible-playbook update.yml -l host1:host2:host3's_cname: ...

The problem I was having here, is that the cname isn't in the inventory, but
since
I was running it against multiple hosts/groups, there isn't a "no hosts
matched"
or similar warning.

If other people would think it useful, I would propose one of:

A) Warn when no hosts match an argument from '--limit'

I would interpret any pattern given to --limit to be given expecting
a match (or an exclusion if "!" or "&" is used), so a warning when
some part of it does nothing would be useful.

This seems reasonable.

That way, ansible all -a "echo test" -l host1:fat_finger
would warn you that you there is no fat_finger host or group.

B) Allow cname or alias names in the inventory

This would tell Ansible that I don't really mean "host3's cname" and would
interpret it as "host3".

We can already do "ansible_ssh_host" for when the host needs to be
contacted from a different name but that really puts in more than one
host record.

The idea of adding aliases though does make sense.