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

Role installs packages in Docker, but doesn't configure or enable the service #15

Open
ctorgalson opened this issue Jul 26, 2022 · 1 comment

Comments

@ctorgalson
Copy link

ctorgalson commented Jul 26, 2022

This isn't really a bug :)

I was testing a role in Molecule that uses robertdebock.firewall as a dependency, and noticed the firewall wasn't configured or enabled. Looking in the code, I see tasks/main.yml installs packages as required, but then does nothing else.

This raises two questions for me:

  1. Should the playbook even install packages in the docker context? Something like this as the first task (or as a later task if there's a reason for still installing the packages) could replace the docker part of the nine existing when checks (without failing the host):

     - name: End the play for docker hosts.
       meta: end_host
       when: ansible_connection in [ "container", "docker", "community.docker.docker" ]
    
  2. Would you be willing to include an override condition allowing the role to run in docker for CI etc? Then something like this should work:

     - name: End the play for docker hosts (except when forced).
       meta: end_host
       when:
         - ansible_connection in [ "container", "docker", "community.docker.docker" ]
         - firewall_skip_on_docker
    

    If firewall_skip_on_docker: true were provided as a default, it would permit existing consumers of the role to go about their business without changes.

If either/both of these (or some variant) appeals to you, I'd be happy to create an MR.

@tdelaney1
Copy link

I am in the same boat with this. I am trying to test a playbook with molecule docker using this role, and my tests simply fail because these get skipped over and don't actually apply on the container. It would be nice if I could simply override this, I'm struggling to find a workaround for this.

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

No branches or pull requests

2 participants