Below is a my current config,.pp file....  I'm trying to create a condition 
that says

if (/etc/ldap.conf contains the string host1.mydomain.com or 
host2.mydomain.com)
  Then install an sshd_ldap.erb template
 else if (/etc/ldap.conf contains the string hostB.mydomain.com or 
hostA.mydomain.com)
     Then install an sshd_freeIPA.erb template
   else  install a standard template.

The code does not work as written.  Any advice to suggestions would be 
greatly appreciated.

Thanks in advance.

class ssh::config inherits ssh {
  file_content { '/etc/ldap.conf':
    ensure => file,
  }
  if $file_content == "host1.mydomain.com || host2.mydomain.com"
  {
    file { '/etc/ssh/sshd_config':
        ensure => present,
        owner => $owner,
        group => $group,
        mode => '0644',
        backup => false,
        content => template("sshd_config_ldap.erb"),
      }
      file { '/etc/ssh/ssh_config':
        ensure => present,
        owner => $owner,
        group => $group,
        mode => '0644',
        backup => false,
        content => template("ssh_config_ldap.erb"),
      }
  }
  elsif $file_content == "hostB.mydomain.com || hostA.mydomain.com"
  {
    file { '/etc/ssh/sshd_config':
        ensure => present,
        owner => $owner,
        group => $group,
        mode => '0644',
        backup => false,
        content => template("sshd_config_ipa.erb"),
      }
      file { '/etc/ssh/ssh_config':
        ensure => present,
        owner => $owner,
        group => $group,
        mode => '0644',
        backup => false,
        content => template("ssh_config_ipa.erb"),
      }
  }
  else
  {
    file { '/etc/ssh/sshd_config':
        ensure => present,
        owner => $owner,
        group => $group,
        mode => '0644',
        backup => false,
        content => template("sshd_config_standard.erb"),
      }
      file { '/etc/ssh/ssh_config':
        ensure => present,
        owner => $owner,
        group => $group,
        mode => '0644',
        backup => false,
        content => template("ssh_config_standard.erb"),
      }
  }
}

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/7a70eb36-0388-46a7-9988-b61e024b796d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to