5

I am just starting to work with Ansible Tower and made a project and then a job template under that project that uses a small initial test playbook (Test.yml):

---
- hosts: east01.xxxxx.com
  become: yes
  become_method: sudo

  tasks:
  - name: test
    shell: echo 'line one line two line three' >> /tmp/abcdef.txt

and, when I try to run that playbook by clicking the "rocketship" in Tower, it looks like it is working:

Identity added: /tmp/awx_35003_yehjodc1/artifacts/35003/ssh_key_data (/tmp/awx_35003_yehjodc1    /artifacts/35003/ssh_key_data)
[WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details
PLAY [east01.xxxxx.com] **********************************************
TASK [Gathering Facts] *********************************************************
ok: [east01.xxxxx.com]
TASK [test] ********************************************************************
changed: [east01.xxxxx.com]
PLAY RECAP *********************************************************************
east01.xxxxx.com : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 

and it looks like that is actually working (I can see the file on the target machine being modified when I run the playbook), but can someone tell me what is causing that WARNING:

[WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details

??

Also the warning says to "use -vvvv" and I was wondering where/how do I do that (since I am running this playbook under Tower)?

Thanks! Jim

EDIT: I just did a test, where I ran the same yaml file using ansible-playbook (command line) and it ran without that warning, so I guess that the warning is something to do with some difference between ansible-playbook and Tower?

user555303
  • 1,146
  • 3
  • 20
  • 44
  • (a) did you try `- debug: var=groups` to see what groups are being used in Tower? (b) [of course Tower has verbosity control](https://docs.ansible.com/ansible-tower/3.8.1/html/userguide/job_templates.html#create-a-job-template) – mdaniel Feb 13 '21 at 19:04

2 Answers2

15

This warning appears when you are using dashes in your inventory file when you declaring your group names. For instance if your inventory file looks like this:

[web-servers]
ubuntu ansible_ssh_host=xxx.xxx.xxx.xxx

Ansible will throw that warning. Instead, if you will be using underscores, the warning is gone.

[web_servers]
ubuntu ansible_ssh_host=xxx.xxx.xxx.xxx
Skeptic
  • 1,254
  • 14
  • 18
  • NB: when doing this change in AWX/Ansible Tower, the old group is kept and must be manually deleted. A simple replacement in the inventory which is synced from a git repo is not enough. – pat-s Nov 16 '22 at 17:23
10

Your version of ansible-playbook is probably older than the version of Ansible being used in Tower.

In recent versions of Ansible, group names must be valid variable names. See the docs for details on what constitutes a valid variable name.

If east01.xxxxx.com is a group name, the periods are the problem. Otherwise, check you group names for anything not a letter, digit, or _.

larsks
  • 277,717
  • 41
  • 399
  • 399
  • larsks - I found the reason - in the inventory I had selected in Tower, there was one group whose group name has a dash ("-") in it and there was a red question mark next to its name. Actually, also, when I look at the list of inventories that particular inventory name ("Sandbox") has a red question mark next to it, probably because that group had that base group name? Thanks, – user555303 Feb 14 '21 at 20:23