Problem: Non-compliant Role Paths Result in Role Not Found Error
zzecool opened this issue · comments
Issue
My structure is like this :
ansible/
├── playbooks/
│ └── servers_daily_maintenance.yml
│
└── roles/
├── prune_dangling_docker_resources/
│ └── tasks/
│ └── main.yml
│
└── update_apt_servers/
└── tasks/
└── main.yml
This is by the Ansible documentation.
When i run the playbook servers_daily_maintenance.yml it fails like this :
No roles/requirements.yml file found. Skip galaxy install process.
ERROR! the role 'update_apt_servers' was not found in /tmp/semaphore/repository_5_52/playbooks/roles:/tmp/semaphore/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/tmp/semaphore/repository_5_52/playbooks
The error appears to be in '/tmp/semaphore/repository_5_52/playbooks/servers_daily_maintenance.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:
- update_apt_servers
^ here
Running playbook failed: exit status 1
Am I missing somthing ?
Thanks in advance.
Impact
Ansible (task execution), Configuration, Semaphore Project
Installation method
Docker
Browser
Chrome
Semaphore Version
v2.9.75
Ansible Version
No response
Logs & errors
No response
Manual installation - system information
No response
Configuration
No response
Additional information
No response
Im blind.
Thomas helped me in Telegram
I have to either move roles under playbooks or add ANSIBLE_ROLES_PATH=
Thanks Thomas !
I think we can close this, right?
sorry for the noob questions but where would you add ANSIBLE_ROLES_PATH ? in the enviromnent, in your playbook ? What would that be then ? ANSIBLE_ROLES_PATH=../ ?
I found this issue : #1609 which adds in the root ansible.cfg which adds : roles in the repo as valid path :
[defaults]
roles_path = roles:/tmp/semaphore/.ansible/roles:/usr/share/ansible/roles
collections_paths = collections:/tmp/semaphore/.ansible/collections:/usr/share/ansible/collections
So that solves it for me :)
For the docker deployment you can define this as an env variable.