tower-cli "Failed up update host"

Built AWX 15.0.1 recently instead of just installing the default image, strange bug occurred this morning with this code:

- name: Install tower dep
delegate_to: 127.0.0.1
pip:
name: ansible-tower-cli

- name: Add new host to organisations inventory
delegate_to: 127.0.0.1
tower_host:
name: "matrix.{{ matrix_domain }}"
description: "{{ matrix_domain }} Matrix Server"
inventory: "{{ member_id }}"
state: present
tower_host: "{{ tower_host }}"
tower_username: "{{ tower_username }}"
tower_password: "{{ tower_password }}"
validate_certs: yes
register: fs_host

I’ve seen this run without issue about a hundred times, today I start receiving this error message:


TASK [modify-awx-account : Add new host to organisations inventory] ************

**[WARNING]: The value 35 (type int) in a string field was converted to '35'**

**(type string). If this does not look like what you expect, quote the entire**
**value to ensure it does not change.**
fatal: [dummyvalue.com]: FAILED! => {"changed": false, "msg": "Failed to update host: There was a network error of some kind trying to connect to Tower.\n\nThe most common reason for this is a settings issue; is your \"host\" value in `tower-cli config` correct?\nRight now it is: \"panel.topgunmatrix.com\"."}

First question i guess, when you run the ‘tower_host’ module in AWX where is the binary it calls? I would assume it’s inside the container but i was unable to locate it after trying to run awx-cli or tower-cli within the AWX container:

bash-4.4# tower-cli --config
bash: tower-cli: command not found

bash-4.4# awx-cli --config
bash: awx-cli: command not found

I imagine if i had ‘https://’ infront of the host value it would start working, but i’m unsure where to configure this.

First thing i’m going to try is rolling back to the default AWX 15.0.1 image.

Reinstalling AWX didn’t fix it.

This slight adjustment of the above code seems to have fixed it:

- name: Add new host to organisations inventory
delegate_to: 127.0.0.1
tower_host:
name: "matrix.{{ matrix_domain }}"
description: "{{ matrix_domain }} Matrix Server"
inventory: "{{ member_id }}"
state: present
tower_host: "https://{{ tower_host }}"
tower_username: "{{ tower_username }}"
tower_password: "{{ tower_password }}"
validate_certs: yes
register: fs_host

Strangely, other tasks that just use tower_host: "{{ tower_host }}" after this one seem to work fine. :stuck_out_tongue: Very strange indeed.

Hopefully this is helpful to someone.