saz/puppet-sudo

How can I add Cmnd_Alias

glafir opened this issue · 1 comments

Hellow!
How can I add Cmnd_Alias in module for example in sudoers config:

Cmnd_Alias APACHE_START = /usr/bin/service apache2 start
Cmnd_Alias APACHE_STOP = /usr/bin/service apache2 stop
Cmnd_Alias APACHE_RESTART = /usr/bin/service apache2 restart
Cmnd_Alias APACHE_RELOAD = /usr/bin/service apache2 reload

I did this in yaml

  sudo::configs:
    configs_hash:
      cmd_alias:
        priority: 5
        content:
        - 'Cmnd_Alias APACHE_START = /usr/bin/service apache2 start'
        - 'Cmnd_Alias APACHE_STOP = /usr/bin/service apache2 stop'
        - 'Cmnd_Alias APACHE_RESTART = /usr/bin/service apache2 restart'
        - 'Cmnd_Alias APACHE_RELOAD = /usr/bin/service apache2 reload'

But it didn`t work (((

saz commented

There is no type for command aliasses. You have to pass the information to sudo::conf.

Using a file:

sudo::conf { 'web':
      source => 'puppet:///files/etc/sudoers.d/web',
    }

where file content is

Cmnd_Alias APACHE_START = /usr/bin/service apache2 start
Cmnd_Alias APACHE_STOP = /usr/bin/service apache2 stop
Cmnd_Alias APACHE_RESTART = /usr/bin/service apache2 restart
Cmnd_Alias APACHE_RELOAD = /usr/bin/service apache2 reload

# Any other sudo option which might fit in this file

or pass the values as content to sudo::conf