Awx: roles/requirements.yml not loaded

Created on 30 Apr 2018  路  20Comments  路  Source: ansible/awx

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • UI
SUMMARY

The YAML files are stored in a git repo and successfully downloaded via a "Project" in AWX.
However, when the playbook is launched, the galaxy roles defined in [git repo]/roles/requirements.yml are not loaded, leading to a fatal error.

ENVIRONMENT
  • AWX version: 1.0.6.1
  • AWX install method: docker on linux (Debian 9)
  • Ansible version: Ansible 2.5.2
  • Operating System: Linux (Debian 9)
  • Web Browser: Chrome 66
STEPS TO REPRODUCE

1a) Create the following files;

/test1.yml
/roles/requirements.yml
1b) /test1.yml

---
- hosts: all

  roles:
    - yatesr.timezone
  vars:
    timezone: Europe/Berlin

1c) /roles/requirements.yml

---
- src: yatesr.timezone

2) Sync the AWX project owning the git repo
3) Create a template job and configure it as following:

  • Job Type = Run
  • Inventory = __
  • Project = __
  • Playbook = /test1.yml
  • Check "Enable Concurrent Jobs"
  • Check "Use Fact Cache"

4) Run the job.

EXPECTED RESULTS

The playbook should run without error.

ACTUAL RESULTS
ansible-playbook 2.5.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/usr/lib/python2.7/site-packages/awx/plugins/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
Using /etc/ansible/ansible.cfg as config file
 [ERROR]:

Parsed /tmp/awx_98_15kXc8/tmpuRtOnI inventory source with script plugin
ERROR! the role 'yatesr.timezone' was not found in /var/lib/awx/projects/_6__playbooks_inventories/roles:/var/lib/awx/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/var/lib/awx/projects/_6__playbooks_inventories

The error appears to have been in '/var/lib/awx/projects/_6__playbooks_inventories/test1.yml': line 5, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
    - yatesr.timezone
      ^ here
ADDITIONAL INFORMATION

When running the playbook manually via Ansible CLI (ie out of AWX), it works as expected.

api bug

All 20 comments

What does the log for the checkout job for that playbook run look like? You can access it from the green dot next to the project definition for the job run.

It seems to look fine. Here it is:

Enter passphrase for /tmp/awx_99_rzW9Qu/credential_3: 
Identity added: /tmp/awx_99_rzW9Qu/credential_3 (/tmp/awx_99_rzW9Qu/credential_3)
Using /etc/ansible/ansible.cfg as config file


PLAY [all] *********************************************************************

TASK [delete project directory before update] **********************************
skipping: [localhost]

TASK [check repo using git] ****************************************************
ok: [localhost]

PLAY [all] *********************************************************************

TASK [detect requirements.yml] *************************************************
ok: [localhost]

TASK [fetch galaxy roles from requirements.yml] ********************************
changed: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=3    changed=1    unreachable=0    failed=0

If you look at the event for the role fetch, did it successfully pull it down?

Same issue here, but you can't view the event for that fetch. At least, it wasn't letting me. No place to click like a normal playbook run.

No, there is no trace from the role fetched.
I went a little further by disabling the check "_does requirements.yml exists?_" in project_update.yml, and the role was fetched, but the playbook failed (still unable to find the role).

Same issue from my side.
Despite the succesful SCM update the role required is not installed.

I noticed that the "-p" parameter from the "ansible-galaxy install" command is not properly handled.

Below the output of the command sent during the playbook (executed from command line)

[root@awx ~]# ansible-galaxy install -r requirements.yml -p /var/lib/awx/projects/_6__myproject/roles/ --force
ERROR! Unable to open requirements.yml: [Errno 2] No such file or directory: u'requirements.yml'

Here instead the result with a different addressing of the _requirements.yml_ position

[root@awx ~]# ansible-galaxy install -r /var/lib/awx/projects/_6__myproject/roles/requirements.yml --force
* downloading role '7zip', owned by meyerf99
* downloading role from https://github.com/meyerf99/ansible-7zip/archive/master.tar.gz
* extracting meyerf99.7zip to /root/.ansible/roles/meyerf99.7zip
* meyerf99.7zip (master) was installed successfully

Hoping this can be helpfull to solve the problem

What ansible version? Is it 2.5.2 for all of you?

ENVIRONMENT

  • AWX version: 1.0.6.3
  • AWX install method: docker-compose on linux (Ubuntu 16.04)
  • Ansible version: Ansible 2.5.2
  • Operating System: Linux (Ubuntu 16.04)
  • Web Browser: Chrome 67.0.3396.18

I upgraded to AWX 1.0.6.3 (Ansible 2.5.2), and still the same issue.

I also could not get roles to download with any combination of settings.

  • AWX 1.0.6.0
  • Ansible 2.5.2
  • RHEL 7 + Docker

I turned on debug in ansible.cfg to see the command being ran from project_update.yml:
ansible-galaxy install -r requirements.yml -p /var/lib/awx/projects/_15__mulesoft_playbooks_devel/roles/ __omit_place_holder__844789ae303bc79148014e5939498c7f66f2d002

Running that manually does not install the role (although I'm not sure if the omit placeholder is actually used).

I was able to make it work by removing this from the end of line 142 in project_update.yml -
{{ scm_result is defined|ternary('--force',omit) }}

Indeed, it works by removing {{ scm_result is defined|ternary('--force',omit) }}.

However, if the playbook is not in the root folder [git repo]/test1.yml, then it does not work (wherever is roles/requirements.yml)

Confirmed here as well.

I reverted commit https://github.com/ansible/awx/commit/b3ca7acb41d1d9215e9f5171d41d4c82e37794b0 locally and that seems to have fixed the issue with roles not being imported for me.

The issue seems to come from this piece of code in the same file (project_update.yml):

      - name: break if already checked out
        meta: end_play
        when: scm_full_checkout|default('') and repo_check is succeeded and repo_check.before == scm_branch

All the 3 rules are always true, forcing AWX to skip the update of the git repo. Therefore the variable scm_result always remains empty, which prevents running ansible-galaxy.

The goal of the conditional is to run with --force when scm_result is defined, and to omit the parameter when not. Will debug some more at a future point.

Hi, sorry, i noob. I faced the same problem, how to fix it?

ENVIROMENT:

  • Ansible 2.5.2
  • CentOS 7 + Docker
  • AWX 1.0.6.5

Hi guys even I am facing the same problem

I am using docker as well, facing same issue, could you please provide the solution for this,,,

Just merged a fix for this, it should show up in subsequent builds. (See #1878 for details).

Same issue here...

AWX 1.0.6.5
Ansible 2.5.5

Within a project, /roles/requirements.yml is totally ignored

Same probleme:

PLAY [all] **********************
TASK [detect requirements.yml]
***************
skipping: [localhost]
TASK [fetch galaxy roles from requirements.yml]
*********
skipping: [localhost]
TASK [fetch galaxy roles from requirements.yml (forced update)] ****
skipping: [localhost]

Steps are skiped ....

Ansible 2.6.5 awx 2.0.0

Was this page helpful?
0 / 5 - 0 ratings