Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

hostname with -\d+ crash the installation #130

Open
gui1117 opened this issue Aug 14, 2017 · 4 comments
Open

hostname with -\d+ crash the installation #130

gui1117 opened this issue Aug 14, 2017 · 4 comments

Comments

@gui1117
Copy link

gui1117 commented Aug 14, 2017

because of the following rule https://github.com/ideascube/ansiblecube/blob/oneUpdateFile/roles/set_custom_fact/tasks/main.yml#L91
(but there other same replacement)

the hostname is modified unexpectedly and so not found in device list

@gui1117
Copy link
Author

gui1117 commented Aug 15, 2017

can't we use ideascube_project_name instead of hostname ?

@fheslouin
Copy link
Collaborator

I don't understand how the line https://github.com/ideascube/ansiblecube/blob/oneUpdateFile/roles/set_custom_fact/tasks/main.yml#L91 could replace unexpectedly the hostname.

{{ ansible_hostname }} variable is used here specifically to ensure that the hostname is correctly recorded, I use it against device_list.fact to ensure the device we are going to setup has a json declaration.

Further in the playbook I use {{ ansible_hostname }} mainly for convenience.

ideascube_project_name is only used with a master tag and can not be used with other tags.

Does this answer help you ?

@gui1117
Copy link
Author

gui1117 commented Aug 19, 2017

I don't understand how the line https://github.com/ideascube/ansiblecube/blob/oneUpdateFile/roles/set_custom_fact/tasks/main.yml#L91 could replace unexpectedly the hostname.

let's say the hostname: '-123', then ansible_hostname would be something like '-123-999'. after replace it would be ''

using the end of line marker would resolve the regex, something like this: '-\d+$'

@letompouce
Copy link
Member

The regex is loose because it worked for us and our undefined-but-consistent naming scheme, and we don't plan to ship any box named r2d2-6po - yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants