I think the python version is the problem here.
I see the behavior with ansible using python 3.6.x on a host system or in 
the current awx container (12.0.0 or 13.0.0). AWX uses python 3.6 currently.
When I use ansible with Python 3.8.x, I see the correct result like you 
described.

Regards
CWollinger

Am Donnerstag, 25. Juni 2020 17:35:48 UTC+2 schrieb Stu:
>
> 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:* [email protected] <javascript:> <
> [email protected] <javascript:>> *On Behalf Of *CWollinger
> *Sent:* 25 June 2020 15:57
> *To:* Ansible Project <[email protected] <javascript:>>
> *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 [email protected] <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/0061cc9d-d2f2-43f4-8f70-ad60c720b5ado%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-project/0061cc9d-d2f2-43f4-8f70-ad60c720b5ado%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> --
> *Stuart Lowe*
> Cloud & Hosting Engineer
> *Zen Internet*
> Team: 01706 902009
> Web: zen.co.uk
>
> 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 
>

-- 
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/78cf7a7b-e804-4e11-847b-5796a52e9eeeo%40googlegroups.com.

Reply via email to