MrMEEE / awx-build

144 stars 39 forks source link

Missing Inventory Collections #280

Closed jwinderWCB closed 2 years ago

jwinderWCB commented 4 years ago

I am doing a fresh install of AWX 11.2 on top of RHEL 7.8. My primary inventory is coming from Satellite 6.7. When I attempt to sync the inventory I get the errors below. After reading the upstream documentation, and messing around with the files created in /tmp as part of the sync, I believe I have located the issue.

It appears there should be a directory /var/lib/awx/vendor/inventory_collections that would contain the inventory collections. In the upstream container builds, this directory is populated by the build script and a collections_requirements.yml file.

I haven't been able to locate how this directory is populated in our builds, or any evidence that yml file get copied to our servers. Any guidance will be greatly appreciated! I believe this is my last hurdle to migrating from 9.2 to 11.2.

Thank you in advance!

2.402 INFO Updating inventory 23: rh-satellite1.wcbradley.net 3.250 INFO Reading Ansible inventory source: /tmp/awx_15_b4fydo5l/foreman.yml 3.252 INFO Using VIRTUAL_ENV: /var/lib/awx/venv/ansible/ 3.252 INFO Using PATH: /var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/opt/awx/bin:/bin:/sbin:/usr/bin:/usr/sbin 3.252 INFO Using PYTHONPATH: /var/lib/awx/venv/ansible/lib/python3.6/site-packages: Traceback (most recent call last): File "/bin/awx-manage", line 11, in <module> sys.exit(manage()) File "/usr/lib/python3.6/site-packages/awx/__init__.py", line 152, in manage execute_from_command_line(sys.argv) File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/usr/lib/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1139, in handle raise exc File "/usr/lib/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1029, in handle venv_path=venv_path, verbosity=self.verbosity).load() File "/usr/lib/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 215, in load return self.command_to_json(base_args + ['--list']) File "/usr/lib/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 198, in command_to_json self.method, proc.returncode, stdout, stderr)) RuntimeError: ansible-inventory failed (rc=1) with stdout: stderr: ansible-inventory 2.9.12 config file = None configured module search path = ['/var/lib/awx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /var/lib/awx/venv/ansible/lib/python3.6/site-packages/ansible executable location = /var/lib/awx/venv/ansible/bin/ansible-inventory python version = 3.6.8 (default, Sep 26 2019, 11:57:09) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] No config file found; using defaults [WARNING]: * Failed to parse /tmp/awx_15_b4fydo5l/foreman.yml with auto plugin: inventory config '/tmp/awx_15_b4fydo5l/foreman.yml' specifies unknown plugin 'theforeman.foreman.foreman' File "/var/lib/awx/venv/ansible/lib/python3.6/site-packages/ansible/inventory/manager.py", line 280, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/var/lib/awx/venv/ansible/lib/python3.6/site-packages/ansible/plugins/inventory/auto.py", line 53, in parse raise AnsibleParserError("inventory config '{0}' specifies unknown plugin '{1}'".format(path, plugin_name)) [WARNING]: Unable to parse /tmp/awx_15_b4fydo5l/foreman.yml as an inventory source ERROR! No inventory was parsed, please check your configuration and options.

jwinderWCB commented 4 years ago

I have found a work around. I'm not sure this is the best solution, but what I did was,

1) grab the requirements/collections_requirements.yml file from upstream an put it in /var/lib/awx/ 2) ran the following

# sudo -u awx bash
$ mkdir -p vendor/inventory_collections
$ . venv/ansible/bin/activate
$ ansible-galaxy collection install -r collections_requirements.yml -p /var/lib/awx/vendor/inventory_collections

After doing this I was able to sync my inventory.

I hope this helps.

MrMEEE commented 2 years ago

Project has been updated and moved...

Please move to the new version and report any issues

PROJECT MOVED: https://github.com/miracle-as/AWX-RPM

Issues at: https://github.com/miracle-as/AWX-RPM/issues

**Install guide, tools, utilities are located at: https://awx.wiki

LinkedIn group for Questions, support, talk and more: https://www.linkedin.com/groups/13694893/