Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability of installing roles by reading several requirements.yml files placed on subdirectories inside of roles/ #3887

Closed
wants to merge 1 commit into from

Conversation

gabops
Copy link

@gabops gabops commented May 13, 2019

SUMMARY

At the moment AWX only supports installing roles if those are placed in a requirements.yml inside of roles/ (roles/requirements.yml). This change gives the flexibility to detect and read one or several requirements.yml files that can be placed in any subdirectory under the parent directory "roles/"

This can be useful when you want to split the roles, for example, by origin in different requirements.yml files in your Ansible repo. Personally I find this way much cleaner that mixing everything in just one roles/requirements.yml.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME
  • Installer
AWX VERSION

awx: 4.0.0

ADDITIONAL INFORMATION

This is compatible with the expected functionality this process has right now, however, it allows you to have a configuration on your repo like for example:

roles/
 |_company/requirements.yml
 |_galaxy/requirements.yml
 |_whatever/requirements.yml

Or just:

roles/requirements.yml

Or even:

roles/
 |_directory1
    |_subdirectory1/requirements.yml

Or all the previous combined.

When updating your project from the web interface as usual, all the roles will be pulled by "ansible-galaxy install" on their respective directory where the requirement file is.

…ml files placed on subdirectories inside of roles/
@gabops gabops changed the title Add the ability of installing roles by reading several requirements.y… Add the ability of installing roles by reading several requirements.yml files placed on subdirectories inside of roles/ May 13, 2019
@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@wenottingham
Copy link
Contributor

Arguably, if this is done at playbook run time in that checkout task, it should only checkout roles adjacent to that playbook. But we don't pass that in right now.

@gabops
Copy link
Author

gabops commented May 15, 2019

Arguably, if this is done at playbook run time in that checkout task, it should only checkout roles adjacent to that playbook. But we don't pass that in right now.

Not sure about an strict reason for doing that in that way 🤔
Do you mean that the reference to "{{project_path|quote}}/roles/" is not a good approach for looking for and installing the roles?

@gabops
Copy link
Author

gabops commented May 15, 2019

About the failed build, I have been having a look to the logs and I cannot find anything explicitly related with the change I've done. Any help here would be much appreciated.

https://ansible.softwarefactory-project.io/logs/87/3887/dc5b32a1b05f47578624216a10eae204f36ee5cb/check/tox-awx-ui-lint/8c06fea/ara-report/#

@wenottingham
Copy link
Contributor

Not sure about an strict reason for doing that in that way

Project checkouts run at two times:

  • when performing an update (to get the new revision)
  • when starting a job (to ensure the proper revision is checked out)

For the second of these, the only roles that are relevant are the one adjacent to the playbook being run. So it could be optimized for that case. I'm mostly just noodling; I don't know that it needs to be optimized for that.

@ryanpetrello
Copy link
Contributor

Hey @gabops,

Thanks for opening this. We've made some very notable changes to requirements.txt and especially roles and collection parsing since May, so I'm going to close this PR for now (because it's quite out of date).

We've opened an issue to track this (#106); you're welcome to follow along there or take another stab at it with a PR.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants