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
14.11k stars 3.43k forks source link

Not able to import inventory to AWX from host #10137

Open trinesh17 opened 3 years ago

trinesh17 commented 3 years ago
ISSUE TYPE
COMPONENT NAME
SUMMARY

I installed AWX using awx-operator. Issue1: I didn't get what password to give inside the awx-task container when prompts for sudo password. Issue2: Getting this error FileNotFoundError: [Errno 2] No such file or directory: 'podman' while importing the inventory from host file

ENVIRONMENT
STEPS TO REPRODUCE

Login to the awx-task container and run the below command awx-manage inventory_import --inventory-name inventory --source /var/lib/awx/projects/inventory My file is the source given and the inventory is already created in AWX

EXPECTED RESULTS

Inventory is imported successfully

ACTUAL RESULTS
1.390 INFO     Updating inventory 4: inventory

2021-05-07 07:32:35,559 DEBUG [-] awx.analytics.job_lifecycle inventoryupdate-21 created 1.469 INFO Reading Ansible inventory source: /var/lib/awx/projects/inventory Traceback (most recent call last): File "/usr/bin/awx-manage", line 8, in sys.exit(manage()) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/init.py", line 164, in manage execute_from_command_line(sys.argv) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, *cmd_options) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(args, **options) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/management/commands/inventory_import.py", line 872, in handle data = AnsibleInventoryLoader(source=source, venv_path=venv_path, verbosity=verbosity).load() File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/management/commands/inventory_import.py", line 132, in load return self.command_to_json(base_args) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/management/commands/inventory_import.py", line 108, in command_to_json proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "/usr/lib64/python3.8/subprocess.py", line 854, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib64/python3.8/subprocess.py", line 1702, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'podman'

ADDITIONAL INFORMATION

Please help me with the above 2 issues as i couldn't find any results in the internet

trinesh17 commented 3 years ago

Our projects are getting impacted due to this blocker. Kindly provide the resolution asap. Thanks in advance!

wenottingham commented 3 years ago

awx-manage inventory_import will not work when only using container groups for automation, there is no workaround at this time other than to move to inventory from SCM.

trinesh17 commented 3 years ago

In our previous release, we used awx 15.0.0 and used that feature of importing the yml file to awx at a stretch. And now when we are planning to migrate to newer version(>=19.0.0) this is removed...strange!

AlanCoding commented 3 years ago

This is going to be hard. By design, the web / task containers are not expected to have either podman or ansible-playbook.

If the management command is going to work at all, maybe it will have to do so by submitting the job itself. After all, the interface that the dispatcher uses isn't too complicated. It imports RunInventoryUpdate from the tasks code, passes the job and then checks back until the subprocess finishes. Maybe we do something like that, but don't even subprocess.

Just import the task class and run it.

shanemcd commented 3 years ago

So, I think our options are:

ptrinesh commented 3 years ago

I am doing it by pushing the hosts one after the other using tower_host module from awx collection

john-westcott-iv commented 3 years ago

Could we also add the awx.awx collection for a potential solution for this? If ansible-playbook is not in the container we couldn't run the play from there but it could be run from any other host able to run ansible-playbook and connect to Tower via the API.