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

plugins: add role name to vars context for embedded converge.yml use case #2675

Closed
decentral1se opened this issue Apr 27, 2020 · 3 comments
Closed

Comments

@decentral1se
Copy link
Contributor

Desired Behavior

The default cookiecutter defined converge.yml is:

---
- name: Converge
  hosts: all
  tasks:
    - name: "Include {{ cookiecutter.role_name }}"
      include_role:
        name: "{{ cookiecutter.role_name }}"

Now, if you don't include a converge.yml in your molecule/default and your plugin provides a playbooks/converge.yml file then molecule will load that embedded playbook.

However, we can't embed that in a playbooks dir in the plugin packages because it will not know what the cookiecutter variable is when it is used.

So, we need to inject the role name variable into the context here for this use case.

Seems simple to do.

@decentral1se
Copy link
Contributor Author

decentral1se commented Apr 27, 2020

Continuation of #2671.

This will mean you really can use only molecule/default/molecule.yml as your only config. And if you indeed to use a base config, then migration will become super easy.

@decentral1se decentral1se changed the title Add role name to vars context for embedded converge.yml use case plugins: Add role name to vars context for embedded converge.yml use case Apr 27, 2020
@decentral1se decentral1se changed the title plugins: Add role name to vars context for embedded converge.yml use case plugins: add role name to vars context for embedded converge.yml use case Apr 27, 2020
decentral1se added a commit to ansible-community/molecule-hetznercloud that referenced this issue Apr 27, 2020
decentral1se added a commit to ansible-community/molecule-hetznercloud that referenced this issue Apr 27, 2020
@ssbarnea
Copy link
Member

ssbarnea commented Apr 29, 2020

I am ok with it. I have some concerns regarding the fact that this may promote lack of real testing from some lazy users. In the end, they are supposed to add something inside verify.yml.

Overall, decent defaults that lower the total number of files needed to added are making much easier to adopt the tool.

Keep in mind that sometimes we do not have a role, not all scenarios are hosted inside a role. When implementing this, be aware of this instead of creating a confusing error about a non existing role.

@ssbarnea
Copy link
Member

ssbarnea commented Nov 8, 2020

I am closing this ticket as this is an unlikely use-case and no is expected. Still, keep in mind that a closed ticket does not mean a PR would not not be welcomed, it only means to not expect anyone else to implement it for you.

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

No branches or pull requests

2 participants