List of invalid character(s)

Is the list of invalid character(s) documented somewhere?

I did have dashes in my group names and I replaced them with underscores but now ansible is complaining the period is invalid!

Makes use FQDN for group names a PITA if you cannot use periods.

constants.py:122

INVALID_VARIABLE_NAMES = re.compile(r’[1]|[^\w]')

Really makes it hard to do real-time.com (company domain name)

What is the recommendation or best practices for moving forward?

[real_time_com]?


  1. \d\W ↩︎

constants.py:122

INVALID_VARIABLE_NAMES = re.compile(r'^[\d\W]|[^\w]')

It is document here
https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#creating-valid-variable-names

Really makes it hard to do real-time.com (company domain name)

Dash is subtraction in Jinja, so that is why you can't use that.
Period is used to access attributes in Jinja so foo.bar is the same as foo['bar']

What is the recommendation or best practices for moving forward?

[real_time_com]?

What works for you is probably the best.
I use underscore since that makes is more readable that concatenate it or camel case.

Personally I think it's a stupid limitation. I kind of hope it blows up and they revert the change. Apparently users were getting confused why they couldn't use "groups.group-name" instead of "groups['group-name']", so they banned groups with those types of characters so you can always do groups.group_name. Just don't call your group "get", "copy", "keys", "items", or a host of other special values...

Using "---" as an inventory_hostname is fine, though.

V/r,
James Cassell