How can I accomplish the following in puppet?

If /etc/file1 contains string abc  
   then copy SSHTemplate1 to /etc/ssh/ssh_config  && copy SSHDTemplate1 to 
/etc/ssh/sshd_config
else if /etc/file1 contains string xyz
  then copy SSHtemplate2 to /etc/ssh/ssh_config && copy SSHDTemplate2 to 
/etc/ssh/sshd_config
else copy SSHtemplate3 to /etc/ssh/ssh_config && copy SSHDTemplate3 to 
/etc/ssh/sshd_config

I have to apply this logic multiple operating systems in a Puppet script

So far this is what I have...

class ssh {
    case $::operatingsystem {
      'AIX': {
        $owner = 'root'
        $group = 'system'
        }
      'FreeBSD': {
        $owner = 'root'
        $group = 'wheel'
        }
      default: {
        $owner = 'root'
        $group = 'root'
      }
    }

    file { '/etc/ssh/sshd_config':
      ensure => present,
      owner => $owner,
      group => $group,
      mode => '0644',
      backup => false,
      content => template("ssh/etc/ssh/sshd_config.erb"),
    }

    file { '/etc/ssh/ssh_config':
      ensure => present,
      owner => $owner,
      group => $group,
      mode => '0644',
      backup => false,
      content => template("ssh/etc/ssh/ssh_config.erb"),
    }

    file { '/etc/issue.net':
      ensure => present,
      owner => $owner,
      group => $group,
      mode => '0644',
      backup => false,
      content => template("motd/etc/issue.erb"),
    }
}

Does that look right?  And how to add the the conditional logic above to 
this template?  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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to