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.02k stars 3.42k forks source link

Inventory source from project does not work anymore in 19.4.0 or 19.5.0 #11542

Open maveleo opened 2 years ago

maveleo commented 2 years ago

Please confirm the following

Summary

Not possible to create an inventory sourced from a git project.

AWX version

19.4.0

Installation method

kubernetes

Modifications

no

Ansible version

No response

Operating system

RHEL 8

Web browser

Chrome

Steps to reproduce

Create a project that points to a GIT repository with the inventory definition Sync the project Create an inventory with a source that references the above project Select the inventory file from the drop down menu image Click Sync

Expected results

Inventory source sync succeed, inventory created with groups and hosts

Actual results

Inventory source sync has errors and the inventory is not created/updated

ansible-inventory [core 2.11.3.post0] 
  config file = None
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  ansible collection location = /runner/requirements_collections:/home/runner/.ansible/collections:/usr/share/ansible/collections:/usr/share/automation-controller/collections
  executable location = /usr/local/bin/ansible-inventory
  python version = 3.8.6 (default, Jan 29 2021, 17:38:16) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
  jinja version = 2.10.3
  libyaml = True
No config file found; using defaults
[WARNING]: Ignoring invalid path provided to plugin path:
'/runner/project/integration' is not a directory
setting up inventory plugins
host_list declined parsing /runner/project/integration/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /runner/project/integration/hosts as it did not pass its verify_file() method
auto declined parsing /runner/project/integration/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /runner/project/integration/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /runner/project/integration/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /runner/project/integration/hosts as it did not pass its verify_file() method
[WARNING]: Unable to parse /runner/project/integration/hosts as an inventory
source
ERROR! No inventory was parsed, please check your configuration and options.

Additional information

I have noticed that the worker pod being created does not have any volume references to the projects directory. Also the custom ansible.cfg being defined for the ee_environment does not get loaded in the worker node.

containers:
    - name: worker
      image: my_satellite/ansible/awx-ee:0.6.0
      args:
        - ansible-runner
        - worker
        - '--private-data-dir=/runner'
      resources: {}
      volumeMounts:
        - name: kube-api-access-k9m9b
          readOnly: true
          mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
      imagePullPolicy: IfNotPresent
      stdin: true
      stdinOnce: true
maveleo commented 2 years ago

Looks like the source Sync is happening on the default IG only and will remain pending when configured to run on the controlplane IG Now the problem of the default IG is that it does not have any of the configurations applied to the EE defined for the controlplane IG.

shanemcd commented 2 years ago

@AlanCoding you mind taking a look at this and weighing in with your thoughts or debugging suggestions?

AlanCoding commented 2 years ago

Looks like the source Sync is happening on the default IG only and will remain pending when configured to run on the controlplane IG

Yeah, on openshift all jobs and inventory updates are intended to run as container group jobs. On the controlplane, only the controlplane EE should be used.

I'm following your train of thought here. The project files appear to not be there.

maveleo commented 2 years ago

In k8s the source sync is happening on a pod that does not have access to the projects location and for this reason it cannot work with a project synchronization My workaround was to persist the projects and customise the pod that kubernettes spins up to run the source sync, basically I am mounting for that pod the same location used to store the projects directory.

AlanCoding commented 2 years ago

Considering if https://github.com/ansible/awx-operator/issues/796 is related to this issue, even though it's a different error.

ffirg commented 2 years ago

@maveleo is this still an issue. Quite old AWX versions now, so was looking for an update.

maveleo commented 2 years ago

We will have to plan an upgrade and see if it works now but I doubt it will unless the design has not changed. The problem I faced was by design, the pod that is spinned up to execute the update of the inventory has no visibility of the content downloaded from the project that is sourced from git.

On Wed, 18 May 2022, 19:01 Phil Griffiths, @.***> wrote:

@maveleo https://github.com/maveleo is this still an issue. Quite old AWX versions now, so was looking for an update.

— Reply to this email directly, view it on GitHub https://github.com/ansible/awx/issues/11542#issuecomment-1130329226, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYVOFRWLP5J3PGHRV3TCU3VKUV77ANCNFSM5L6QHZSA . You are receiving this because you were mentioned.Message ID: @.***>