Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!pyobjects
- ######### to be written somewhere else as a general function #####
- def t3source( FILEPATH ):
- import os
- import re
- HOSTNAME = os.uname()[1]
- FILE_POSTFIX = re.split( '[0-9][0-9]', HOSTNAME )[0]
- SOURCE = 'salt://'
- FILE = '/etc/sudoers'
- OS = __salt__['grains.get']('os') # ScientificLinux
- OSREL = __salt__['grains.get']('osrelease')[0] # 5
- SOURCE = 'salt://' + 'OS/'+OS+'/'+OSREL+'/files'+FILEPATH
- return [ SOURCE + '__' + FILE_POSTFIX ,
- SOURCE ]
- ##################################################################
- with Pkg.installed( 'sudo' ):
- File.directory("/etc/sudoers.d" , user = 'root', group = 'root', mode = '0550' )
- FILEPATH = "/etc/sudoers"
- File.managed( FILEPATH ,
- user = 'root' ,
- group = 'root' ,
- mode = '0440' ,
- source= t3source( FILEPATH ) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement