Re: [Puppet Users] Augeas failing when acting on smb.conf

2015-08-04 Thread Martin
Hi,

While no help at all for Augeas: Why don't you simply use a template? It
would also get rid of the exec at the end?

/Martin
On Mon 3 Aug 2015 at 23:04 Fabrizio Zelaya fabr...@gmail.com wrote:

 Hello everyone!

 I am trying to run puppet agent on a SL-6 Machine and one action I'm
 trying to apply is to add the machine to our domain. However I ran into an
 issue when running puppet agent -t

 Debug: Augeas[global](provider=augeas): Opening augeas with root /, lens
 path /var/lib/puppet/lib/augeas/lenses, flags 64
 Debug: Augeas[global](provider=augeas): Augeas version 1.0.0 is installed
 Warning: Augeas[global](provider=augeas): Loading failed for one or more
 files, see debug for /augeas//error output
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error = parse_failed
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error/pos = 2545
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error/line = 67
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error/char = 0
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error/lens =
 /usr/share/augeas/lenses/dist/inifile.aug:391.25-.43:
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error/message = Get did not match entire
 input


 Unfortunately I am very new to augeas and don't really understand the
 references on this messages. So far I've seen that
  /usr/share/augeas/lenses/dist/inifile.aug:391.25-.43: refers to this
 piece of code   # *= comment* . record**


 I'm right now trying to understand if this is a permissions error or
 augeas version or syntax error but I haven't found much about what I'm
 reading on the debug output.

 Here's the versions of what I'm running.

 On Puppet Master

 ruby-augeas-0.4.1-3.el6.x86_64
 augeas-libs-1.0.0-7.el6.x86_64
 augeas-1.0.0-7.el6.x86_64

 puppet-3.8.1-1.el6.noarch
 puppetlabs-release-6-11.noarch
 puppet-server-3.8.1-1.el6.noarch


 On the agent

 taugeas-libs-1.0.0-7.el6.x86_64
 augeas-1.0.0-7.el6.x86_64
 ruby-augeas-0.4.1-3.el6.x86_64

 pe-puppet-enterprise-release-3.8.0.3-1.pe.el6.noarch
 puppet-3.8.1-1.el6.noarch
 puppetlabs-release-6-11.noarch

 Here's the code I'm using

 Samba init.pp

 # Samba base module.
 #
 class samba (
   $workgroup,
   $realm,
   $ensure = 'installed',
   $common_package = $samba::params::common_package,
   $server_pacakge = $samba::params::server_package,
   $winbind_package = $samba::params::winbind_package,
   $conf = $samba::params::conf,
   $winbind_service = $samba::params::winbind_service,
   $krb_package = $samba::params::krb_package,
   $krb_conf = $samba::params::krb_conf,
   $krb_keytab = $samba::params::krb_keytab,
 ) inherits samba::params {

   package { $common_package:
 ensure = $ensure,
   }

   augeas { 'global':
 incl= $conf,
 lens= 'Samba.lns',
 context = /files${conf}/*[. = \global\],
 changes = [
   set 'workgroup' ${workgroup},
   set 'realm' ${realm},
   set 'password server' *,
   set 'security' ads,
   set 'template shell' /bin/bash,
   set 'winbind use default domain' true,
   set 'winbind offline logon' true,
   set 'winbind rpc only' true,
   set 'winbind normalize names' true,
   set 'winbind refresh tickets' true,
   set 'idmap config * : backend' rid,
   set 'idmap config * : range' 16777216-33554431,
   set 'kerberos method' 'secrets and keytab',
   set 'local master' no,
   rm 'idmap uid',
   rm 'idmap gid',
   rm 'idmap backend',
 ],
   }

   exec { /bin/sed -i -r -e \/^\\s*([;#].*)?\$/ d\ -e \s/^\\s*([^[])/
  \\1/\ -e \s/^[[].*/\\n/\ ${conf}:
 refreshonly = true,
 subscribe   = Augeas['global'],
   }

 }

 For Samba param.pp
 # Samba module parameters.
 #
 class samba::params {

   case $::osfamily {

 'RedHat': {

   if $::operatingsystemmajrelease == '5' {
 $base_name = 'samba3x'
   } else {
 $base_name = 'samba'
   }

   $server_package = $base_name
   $common_package = ${base_name}-common
   $winbind_package = ${base_name}-winbind

   $conf = '/etc/samba/smb.conf'

   $winbind_service = 'winbind'

   $krb_package = 'krb5-workstation'
   $krb_conf = '/etc/krb5.conf'
   $krb_keytab = '/etc/krb5.keytab'

 }

 default: {
   fail('Unsupported operating system')
 }

   }

 }


 Would appreciate any help you can give me. Thanks in advance







 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/2fab346b-e0a4-42eb-85c3-d81fc37f6b0e%40googlegroups.com
 

[Puppet Users] Augeas failing when acting on smb.conf

2015-08-03 Thread Fabrizio Zelaya
Hello everyone!

I am trying to run puppet agent on a SL-6 Machine and one action I'm trying 
to apply is to add the machine to our domain. However I ran into an issue 
when running puppet agent -t

Debug: Augeas[global](provider=augeas): Opening augeas with root /, lens 
path /var/lib/puppet/lib/augeas/lenses, flags 64
Debug: Augeas[global](provider=augeas): Augeas version 1.0.0 is installed
Warning: Augeas[global](provider=augeas): Loading failed for one or more 
files, see debug for /augeas//error output
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error = parse_failed
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/pos = 2545
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/line = 67
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/char = 0
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/lens = 
/usr/share/augeas/lenses/dist/inifile.aug:391.25-.43:
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/message = Get did not match entire 
input


Unfortunately I am very new to augeas and don't really understand the 
references on this messages. So far I've seen that 
 /usr/share/augeas/lenses/dist/inifile.aug:391.25-.43: refers to this piece 
of code   # *= comment* . record**


I'm right now trying to understand if this is a permissions error or augeas 
version or syntax error but I haven't found much about what I'm reading on 
the debug output.

Here's the versions of what I'm running.

On Puppet Master

ruby-augeas-0.4.1-3.el6.x86_64
augeas-libs-1.0.0-7.el6.x86_64
augeas-1.0.0-7.el6.x86_64

puppet-3.8.1-1.el6.noarch
puppetlabs-release-6-11.noarch
puppet-server-3.8.1-1.el6.noarch


On the agent

taugeas-libs-1.0.0-7.el6.x86_64
augeas-1.0.0-7.el6.x86_64
ruby-augeas-0.4.1-3.el6.x86_64

pe-puppet-enterprise-release-3.8.0.3-1.pe.el6.noarch
puppet-3.8.1-1.el6.noarch
puppetlabs-release-6-11.noarch

Here's the code I'm using

Samba init.pp

# Samba base module.
#
class samba (
  $workgroup,
  $realm,
  $ensure = 'installed',
  $common_package = $samba::params::common_package,
  $server_pacakge = $samba::params::server_package,
  $winbind_package = $samba::params::winbind_package,
  $conf = $samba::params::conf,
  $winbind_service = $samba::params::winbind_service,
  $krb_package = $samba::params::krb_package,
  $krb_conf = $samba::params::krb_conf,
  $krb_keytab = $samba::params::krb_keytab,
) inherits samba::params {

  package { $common_package:
ensure = $ensure,
  }

  augeas { 'global':
incl= $conf,
lens= 'Samba.lns',
context = /files${conf}/*[. = \global\],
changes = [
  set 'workgroup' ${workgroup},
  set 'realm' ${realm},
  set 'password server' *,
  set 'security' ads,
  set 'template shell' /bin/bash,
  set 'winbind use default domain' true,
  set 'winbind offline logon' true,
  set 'winbind rpc only' true,
  set 'winbind normalize names' true,
  set 'winbind refresh tickets' true,
  set 'idmap config * : backend' rid,
  set 'idmap config * : range' 16777216-33554431,
  set 'kerberos method' 'secrets and keytab',
  set 'local master' no,
  rm 'idmap uid',
  rm 'idmap gid',
  rm 'idmap backend',
],
  }

  exec { /bin/sed -i -r -e \/^\\s*([;#].*)?\$/ d\ -e \s/^\\s*([^[])/ 
 \\1/\ -e \s/^[[].*/\\n/\ ${conf}:
refreshonly = true,
subscribe   = Augeas['global'],
  }

}

For Samba param.pp
# Samba module parameters.
#
class samba::params {

  case $::osfamily {

'RedHat': {

  if $::operatingsystemmajrelease == '5' {
$base_name = 'samba3x'
  } else {
$base_name = 'samba'
  }

  $server_package = $base_name
  $common_package = ${base_name}-common
  $winbind_package = ${base_name}-winbind

  $conf = '/etc/samba/smb.conf'

  $winbind_service = 'winbind'

  $krb_package = 'krb5-workstation'
  $krb_conf = '/etc/krb5.conf'
  $krb_keytab = '/etc/krb5.keytab'

}

default: {
  fail('Unsupported operating system')
}

  }

}


Would appreciate any help you can give me. Thanks in advance







-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2fab346b-e0a4-42eb-85c3-d81fc37f6b0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.