ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.87k stars 3.4k forks source link

awx-manage utility #1889

Closed doves99 closed 6 years ago

doves99 commented 6 years ago
ISSUE TYPE
COMPONENT NAME
SUMMARY

How do i enable or install the awx-manage utility?

ENVIRONMENT
STEPS TO REPRODUCE

type awx-manage at the command line to use the utility

EXPECTED RESULTS

should give the options to use the utility

ACTUAL RESULTS

[root]# awx-manage -bash: awx-manage: command not found

ryanpetrello commented 6 years ago

Hey @doves99,

The awx issue tracker is for bug reporting and feature enhancement requests. For questions and assistance using awx, please check out our mailing list (https://groups.google.com/d/forum/awx-project), or the IRC chatroom on Freenode (#awx-devel).

DVGeoffrey commented 5 years ago

for the love of got delete this thread because this is the only search result for this problem.

Pakbon commented 5 years ago

If it's the only search result for this problem (close to first result in Google), it means loads of people have issues with this that needs to be addressed.

  1. Just closing the thread and providing 0 help leaves them with a sour taste in their mouth.
  2. The Google group mentioned above either does not exist or needs special permission to browse.

It seems awx-manage does exist inside one of the docker containers, found inside /opt/awx/tools/docker-compose.

ryanpetrello commented 5 years ago

@Pakbon,

The google group link above should work just fine publicly. Here it is for me in a private Chrome window:

https://groups.google.com/forum/#!forum/awx-project

image

awx-manage is an executable that's available inside awx containers; it's intended to used/run within an awx container, and isn't a third-party library you can download or install (it's a tool that is part of awx itself).

~/dev/awx docker exec -it tools_awx_run_3b2204dfbb4c bash
bash-4.2$ which awx-manage
/usr/local/bin/awx-manage
bash-4.2$ awx-manage --version
4.0.0-496-g13f9799
bash-4.2$ awx-manage list_instances
[awx capacity=99 policy=100%]
    awx capacity=99 version=4.0.0-496-g13f9799 heartbeat="2019-05-08 16:09:04"

[1 capacity=99 policy=100%]
    awx capacity=99 version=4.0.0-496-g13f9799 heartbeat="2019-05-08 16:09:04"

[2 capacity=99 policy=100%]
    awx capacity=99 version=4.0.0-496-g13f9799 heartbeat="2019-05-08 16:09:04"

[3 capacity=99 policy=100%]
    awx capacity=99 version=4.0.0-496-g13f9799 heartbeat="2019-05-08 16:09:04"
jrosa770 commented 5 years ago

Fantastic non-answer...

ryanpetrello commented 5 years ago

@jrosa770 what exactly isn't answered? awx-manage is an executable that's installed by the AWX installer on the AWX nodes (Docker container, pod, what have you) - it's a Django-based diagnostic tool that lets you work with the local postgres database in a variety of ways that might affect your installation, and it's not something you can install or use outside of that context (because it doesn't make sense to use in a standalone environment outside of a container/pod, it isn't a Python package or RPM you install and use).

reinistihovs commented 4 years ago

HI, What they mean is that "awx-manage" must be run inside a container. to do this first you need to know the container name, by executing: sudo docker ps Next you will see a list of all your running containers. example:

root@awx:/var/lib/awx# sudo docker ps
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                                                 NAMES
43297d309256        ansible/awx_task:9.1.0       "/tini -- /bin/sh -c…"   3 days ago          Up 3 days           8052/tcp                                              awx_task
5b1dc1253cb1        ansible/awx_web:9.1.0        "/tini -- /bin/sh -c…"   3 days ago          Up 3 days           0.0.0.0:8080->8052/tcp                                awx_web
3b3344a7cd6b        memcached:alpine             "docker-entrypoint.s…"   3 days ago          Up 3 days           11211/tcp                                             awx_memcached
2d50fdf2ee35        postgres:10                  "docker-entrypoint.s…"   3 days ago          Up 3 days           5432/tcp                                              awx_postgres
314f1f742751        ansible/awx_rabbitmq:3.7.4   "docker-entrypoint.s…"   3 days ago          Up 3 days           4369/tcp, 5671-5672/tcp, 15671-15672/tcp, 25672/tcp   awx_rabbitmq

To connect to a containers shell you must execute this command: docker exec -it container_name bash

example:

root@awx:/var/lib/awx# docker exec -it awx_task bash
bash-4.4#

So now you are inside the awx_task containers bash shell. Now you can use awx-manage command. example:

#I created a add-hosts.txt file inside the container.
bash-4.4# vi add-hosts.txt
#I imported a list of hosts into awx inventory - UbuntuServers
bash-4.4# awx-manage inventory_import --inventory-name UbuntuServers --source add-hosts.txt
    2.961 INFO     Updating inventory 1: UbuntuServers
    3.667 INFO     Reading Ansible inventory source: /home/awx/add-hosts
    3.671 INFO     Using VIRTUAL_ENV: /var/lib/awx/venv/ansible
    3.671 INFO     Using PATH: /var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    3.671 INFO     Using PYTHONPATH: /var/lib/awx/venv/ansible/lib/python3.6/site-packages:
    5.123 ERROR    ansible-inventory 2.8.5
    5.123 ERROR      config file = /etc/ansible/ansible.cfg
    5.124 ERROR      configured module search path = ['/home/awx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
    5.124 ERROR      ansible python module location = /usr/lib/python3.6/site-packages/ansible
    5.124 ERROR      executable location = /usr/bin/ansible-inventory
    5.124 ERROR      python version = 3.6.8 (default, Oct  7 2019, 17:58:22) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)]
    5.124 ERROR    Using /etc/ansible/ansible.cfg as config file
    5.124 ERROR    host_list declined parsing /home/awx/add-hosts as it did not pass it's verify_file() method
    5.124 ERROR    script declined parsing /home/awx/add-hosts as it did not pass it's verify_file() method
    5.124 ERROR    auto declined parsing /home/awx/add-hosts as it did not pass it's verify_file() method
    5.124 ERROR    Parsed /home/awx/add-hosts inventory source with ini plugin
    5.125 INFO     Processing JSON output...
    5.125 INFO     Loaded 0 groups, 20 hosts
2020-01-09 13:55:57,242 DEBUG    awx.main.models.inventory Going to update inventory computed fields, pk=1
2020-01-09 13:55:57,322 DEBUG    awx.main.models.inventory Finished updating inventory computed fields, pk=1, in 0.079 seconds
    5.352 INFO     Inventory import completed for  (UbuntuServers - 11) in 2.4s
bash-4.4# exit
ps566730 commented 1 year ago

I love how the installation instructions say to use this command before installation to automatically enable the RedHat software collection library for PostGres, but this is a post-installation module (or at least we assume).

"Since automation controller and automation hub are using a Software Collections version of PostgreSQL in 3.8, the rh-postgresql10 scl must be enabled in order to access the database. Administrators can use the awx-manage dbshell command, which will automatically enable the PostgreSQL SCL."

fesm788m commented 1 year ago

I was having this issue when i tried to re-install an ansible-tower instalation , Somehow when i uninstalled old version a file was wandering there and i needed to delete it in order to pass this errror about awx-manage not found.

After i ran the setup.sh to reinstall ansible tower i was getting this error TASK [preflight : Preflight check - check Tower license type] **** fatal: [localhost]: FAILED! => {"changed": true, "cmd": "awx-manage check_license", "delta": "0:00:00.003382", "end": "2023-04-20 13:50:51.503618", "msg": "non-zero return code", "rc": 127, "start": "2023-04-20 13:50:51.500236", "stderr": "/bin/sh: awx-manage: command not found", "stderr_lines": ["/bin/sh: awx-manage: command not found"], "stdout": "", "stdout_lines": []}

After digging and checking logs i noticed somehow a file was being kept there from old ansible tower instalation (/var/lib/awx/.tower_version), so i deleted that single file and it fixed my issue and i was able to re run sudo ./setup.sh

In addition i would like to say, in my case, that awx-manage is available as well in servers installations of ansible-tower not only in docker installation (as many articles found in internet assure) , after i finished my ansible tower reInstalation i can see awx-manage available in my server:

*Somehow that file from the old installation ((/var/lib/awx/.tower_version) was preventing my system to install again awx-manage from watever repo it came.

[user@localhost ansible-tower-setup]$ awx- awx-manage awx-python [user@localhost ansible-tower-setup]$ which awx-manage /usr/bin/awx-manage

fesm788m commented 1 year ago

If it's the only search result for this problem (close to first result in Google), it means loads of people have issues with this that needs to be addressed.

  1. Just closing the thread and providing 0 help leaves them with a sour taste in their mouth.
  2. The Google group mentioned above either does not exist or needs special permission to browse.

It seems awx-manage does exist inside one of the docker containers, found inside /opt/awx/tools/docker-compose.

I was having this issue when i tried to re-install an ansible-tower instalation , Somehow when i uninstalled old version a file was wandering there and i needed to delete it in order to pass this errror about awx-manage not found.

After i ran the setup.sh to reinstall ansible tower i was getting this error TASK [preflight : Preflight check - check Tower license type] **** fatal: [localhost]: FAILED! => {"changed": true, "cmd": "awx-manage check_license", "delta": "0:00:00.003382", "end": "2023-04-20 13:50:51.503618", "msg": "non-zero return code", "rc": 127, "start": "2023-04-20 13:50:51.500236", "stderr": "/bin/sh: awx-manage: command not found", "stderr_lines": ["/bin/sh: awx-manage: command not found"], "stdout": "", "stdout_lines": []}

After digging and checking logs i noticed somehow a file was being kept there from old ansible tower instalation (/var/lib/awx/.tower_version), so i deleted that single file and it fixed my issue and i was able to re run sudo ./setup.sh

In addition i would like to say, in my case, that awx-manage is available as well in servers installations of ansible-tower not only in docker installation (as many articles found in internet assure) , after i finished my ansible tower reInstalation i can see awx-manage available in my server:

*Somehow that file from the old installation ((/var/lib/awx/.tower_version) was preventing my system to install again awx-manage from watever repo it came.

[user@localhost ansible-tower-setup]$ awx- awx-manage awx-python [user@localhost ansible-tower-setup]$ which awx-manage /usr/bin/awx-manage