Cant use dash with numbers as hostname

18 views
Skip to first unread message

CWollinger

unread,
Jun 25, 2020, 10:56:53 AM6/25/20
to Ansible Project
Hi all,

is there a way to escape the dash/minus in the hostname (when using numbers)

hostfile:

test1 ansible_host=10-1
test2 ansible_host="10-1"

Result:

bash-4.4# ansible-inventory -i hosts --list
{
    "_meta": {
        "hostvars": {
            "test1": {
                "ansible_host": 9
            },
            "test2": {
                "ansible_host": 9
            }
        }
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    },
    "ungrouped": {
        "hosts": [
            "test1",
            "test2"
        ]
    }
}

The ansible-inventory made a calculation for the var ....

Thanks & regards
CWollinger
Reply all
Reply to author
Forward
0 new messages