# Awx anisble collection syntax error

**URL:** <https://forum.ansible.com/t/awx-anisble-collection-syntax-error/7608>\
**Category:** Get Help\
**Tags:** playbook, collections, awx\
**Created:** [August 2, 2024, 11:16pm UTC](https://forum.ansible.com/t/awx-anisble-collection-syntax-error/7608 "2024-08-02T23:16:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pwalters04](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/pwalters04/32/2236_2.png) [@pwalters04](https://forum.ansible.com/u/pwalters04)\
**Post date:** [August 2, 2024, 11:16pm UTC](https://forum.ansible.com/t/awx-anisble-collection-syntax-error/7608/1 "2024-08-02T23:16:17Z")

</div>

I have created a playbook to config the awx platform using the awx.awx collection. I have the tower\_cli.cfg in my home directory and I have input environment of the host, username, and password. Below is the playbook I have attempted to run.

```auto
- hosts: localhost
  connection: local
  gather_facts: false
  collections:
    - awx.awx

  tasks:
    - name: Create Inventory
      awx.awx.inventory:
        name: "test"
        organization: "AWX_Admins"
        #controller_config_file: "{{ ansible_config_file }}"
        validate_certs: false
        state: present
      register: inventory
      failed_when: inventory.rc != 0

```

The Error I receive is

```auto
/collections/ansible_collections/awx/awx/plugins/module_utils/controller_api.py", line 154
    endpoint = hostname_prefix + f"{api_path}v2{endpoint}"
                                                         ^
SyntaxError: invalid syntax
fatal: [localhost]: FAILED! => 
  msg: Unexpected failure during module execution.
  stdout: ''"

```

---

<div class="post-metadata">

**Author:** ![Andre\_Muniz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/andre_muniz/32/4357_2.png) [@Andre\_Muniz](https://forum.ansible.com/u/Andre_Muniz)\
**Post date:** [August 3, 2024, 1:47am UTC](https://forum.ansible.com/t/awx-anisble-collection-syntax-error/7608/2 "2024-08-03T01:47:31Z")

</div>

What version of python do you have?

---

<div class="post-metadata">

**Author:** ![pwalters04](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/pwalters04/32/2236_2.png) [@pwalters04](https://forum.ansible.com/u/pwalters04)\
**Post date:** [August 5, 2024, 1:43am UTC](https://forum.ansible.com/t/awx-anisble-collection-syntax-error/7608/3 "2024-08-05T01:43:54Z")

</div>

> [@pwalters04](#):
>
> `ansible_config_file`

The python version is python2 and I think it was using ansible\_config\_file as a variable. I got it going. Thank you for reaching out

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [September 4, 2024, 1:44am UTC](https://forum.ansible.com/t/awx-anisble-collection-syntax-error/7608/4 "2024-09-04T01:44:30Z")

</div>

Closed on September 4, 2024, 1:44am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
