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 support for FreeBSD #41

Open
href opened this issue May 9, 2016 · 4 comments
Open

Add support for FreeBSD #41

href opened this issue May 9, 2016 · 4 comments

Comments

@href
Copy link

href commented May 9, 2016

I like your module a lot and I would love to use it for our environment. Since we're using both Ubuntu and FreeBSD I see a few changes which I would need. Would you be open to these? I'd be happy to send a pull request your way.

Those would the changes that need to be made (for FreeBSD only):

  • The root user's group needs to be wheel
  • The sudoers file needs to be /usr/local/etc/sudoers
  • The sudoers.d folder needs to be /usr/local/etc/sudoers.d
  • The visudo command is found at /usr/local/sbin/visudo

In my opinion this would have to be solved with a config class which contains os-specific variables. Those variables would then be re-used in other parts of the module.

For example:

class sudo::os_specific {
    $sudoers_file = $::osfamily ? {
        'FreeBSD' => '/usr/local/etc/sudoers',
        default  => '/etc/sudoers',
    }
}

And elsewhere:

file { $sudo::os_specific::sudoers_file :
    ...

What do you think. Would you be interested in having this change added and if so, do you agree with the approach?

@arnoudj
Copy link
Owner

arnoudj commented May 9, 2016

That would be appreciated. If you're making a PR, can you do that agains the 2.0 branch?

@href
Copy link
Author

href commented May 9, 2016

Sure, I'll have a PR for you sometime this week.

@href
Copy link
Author

href commented May 10, 2016

Let me know what you think. I couldn't add an acceptance test for FreeBSD because I couldn't find a suitable image and I can't share the one I'm using.

Also the way I added overridable default parameters might be a bit unorthodox. It offers plenty of flexibility however. We can now override the os specific settings on the sudo class, the sudoers definition and by declaring our own version of the sudo::os_specific class:

class { 'sudo::specific' :
    root_user => 'wheel'
} ->
class { 'sudo' : 
   ...
}

@petems
Copy link
Contributor

petems commented May 12, 2016

I've taken some of your ideas and refactored into #45 👍

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

3 participants