Install awx-cli, then what?

674 views
Skip to first unread message

Kevin Knox

unread,
Jan 25, 2021, 2:23:12 PM1/25/21
to AWX Project
I'm obviously without a clue here:
bash-4.4# pip3 install --log ~/install2.log awxkit
Requirement already satisfied: awxkit in /home/awx/.local/lib/python3.6/site-packages
Requirement already satisfied: PyYAML in /usr/lib64/python3.6/site-packages (from awxkit)
Requirement already satisfied: requests in /home/awx/.local/lib/python3.6/site-packages (from awxkit)
Requirement already satisfied: idna<3,>=2.5 in /usr/lib/python3.6/site-packages (from requests->awxkit)
Requirement already satisfied: chardet<5,>=3.0.2 in /home/awx/.local/lib/python3.6/site-packages (from requests->awxkit)
Requirement already satisfied: certifi>=2017.4.17 in /home/awx/.local/lib/python3.6/site-packages (from requests->awxkit)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/awx/.local/lib/python3.6/site-packages (from requests->awxkit)
bash-4.4# awx
bash: awx: command not found

Ryan Petrello

unread,
Jan 25, 2021, 3:28:01 PM1/25/21
to AWX Project
Hey Kevin,

Can you share some details of your environment?  I've given this a shot and it works okay for me:

~ head /etc/os-release -n3
NAME=Fedora
VERSION="32 (Workstation Edition)"
ID=fedora
~ python3 --version
Python 3.8.5
[yossarian] (fedora:●●) ~ python3 -m venv foo
[yossarian] (fedora:●●) ~ source foo/bin/activate
~ pip install awxkit 2>&1 > /dev/null
~ awx -h
usage: awx [--help] [--version] [--conf.host https://example.awx.org] [--conf.token TEXT] [--conf.username TEXT] [--conf.password TEXT] [-k] [-f {json,yaml,jq,human}] [--filter TEXT] [--conf.color BOOLEAN] [-v] resource ...

positional arguments:
  resource
    login               authenticate and retrieve an OAuth2 token
    config              print current configuration values
    import              import resources into Tower
    export              export resources from Tower

...

Kevin Knox

unread,
Jan 25, 2021, 5:24:26 PM1/25/21
to AWX Project
Thanks for the question!

bash-4.4# head /etc/os-release -n3
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"

bash-4.4# python3 --version
Python 3.6.8

bash-4.4# awx -h
bash: awx: command not found

The application may be somewhere in my file system, but I don't know where to start looking for it. 

Kevin




Elijah DeLee

unread,
Jan 25, 2021, 5:44:59 PM1/25/21
to Kevin Knox, AWX Project
Try looking in ~/.local/bin

I'm on fedora 33, which is not too unlike centos8 and thats where my system pip3 installs it.

Maybe your $PATH is not correctly configured to pick up binaries in ~/.local/bin

--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/fd7b40ee-0c47-4c3b-aa18-d658be4dd80bn%40googlegroups.com.


--
Elijah DeLee
------------------
Senior Quality Engineer
Red Hat Ansible Tower

Kevin Knox

unread,
Jan 26, 2021, 8:41:48 AM1/26/21
to AWX Project
Bingo! Thank you. Yes, it was in ~/.local/bin, and yes my path was not configured to find it. Great call!

Kevin

Kevin Knox

unread,
Jan 26, 2021, 3:20:47 PM1/26/21
to AWX Project
For those following along for fun, after getting awx to work, this builds a project-sourced inventory. So much easier than doing it 150 times in the GUI! Thank you to the whole team of people who make this kind of stuff possible!

inventory_name=shared_environment_a
new_inventory=$(awx inventory create --name "$inventory_name" --description 'Autoimport by awx-cli from OEM' --organization 3)
# I will show the find, though the code works easily from $new_inventory's json return value 
found_inventory=$(awx inventory list --name "$inventory_name")
found_inventory_id=$(echo $found_inventory | python3 -c "import sys, json; print(json.load(sys.stdin)['results'][0]['id'])")
awx inventory_sources create --name oem --description 'Autosourced by awx-cli from OEM' \
    --source scm \
    --source_path "ansible/inventory/$inventory_name.yml" \
    --overwrite true \
    --overwrite_vars true \
    --inventory "$found_inventory_id" \
    --update_on_launch true \
    --source_project 30 \
    --update_on_project_update false


Ryan Petrello

unread,
Jan 26, 2021, 4:01:22 PM1/26/21
to AWX Project
Thanks for the feedback Kevin :D

Based on your example, you might be interested to know that the CLI generally lets you specify resources (like inventories) using just their name (assuming you keep them unique across e.g., Organizations).  Try --inventory $inventory_name and see if you can skip the ID lookup.  The same is true for --organization "Some Organization Name"

Kevin Knox

unread,
Jan 26, 2021, 4:44:36 PM1/26/21
to AWX Project
> you can skip the ID lookup
Good to know! Thank you, again, Ryan.

Kevin

kde...@redhat.com

unread,
Jan 26, 2021, 6:32:32 PM1/26/21
to AWX Project
Great news! 

GoMatrix Hosting

unread,
Jan 27, 2021, 4:33:49 AM1/27/21
to AWX Project
I noticed this on Debian 10/11 too, where awxkit will install okay but you can't find it in your path. Would be nice if it worked without having to specify the full path to awxkit.
Reply all
Reply to author
Forward
0 new messages