I’m not getting the same thing happen.
The ansible_host var is expecting a fqdn or ip so should just show like below.
what version of ansible are you using?
# cat test
test1 ansible_host=10-1
test2 ansible_host="10-1"
test3 ansible_host='10-1'
ansible-inventory -i test --list
{
"_meta": {
"hostvars": {
"test1": {
"ansible_host": "10-1"
},
"test2": {
"ansible_host": "10-1"
},
"test3": {
"ansible_host": "10-1"
}
}
},
"all": {
"children": [
"ungrouped"
]
},
"ungrouped": {
"hosts": [
"test1",
"test2",
"test3"
]
}
}
From: ansible...@googlegroups.com <ansible...@googlegroups.com>
On Behalf Of CWollinger
Sent: 25 June 2020 15:57
To: Ansible Project <ansible...@googlegroups.com>
Subject: [ansible-project] Cant use dash with numbers as hostname
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
--
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
ansible-proje...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/0061cc9d-d2f2-43f4-8f70-ad60c720b5ado%40googlegroups.com.
Winner of 'Services Company of the Year' at the UK IT Industry Awards
This message is private and confidential. If you have received this message in error, please notify us and remove it from your system.
Zen Internet Limited may monitor email traffic data to manage billing, to handle customer enquiries and for the prevention and detection of fraud. We may also monitor the content of emails sent to and/or
from Zen Internet Limited for the purposes of security, staff training and to monitor quality of service.
Zen Internet Limited is registered in England and Wales, Sandbrook Park, Sandbrook Way, Rochdale, OL11 1RY Company No. 03101568 VAT Reg No. 686 0495 01
To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0061cc9d-d2f2-43f4-8f70-ad60c720b5ado%40googlegroups.com.