Skip to content

Instantly share code, notes, and snippets.

@hunner
Created September 28, 2016 12:22
Show Gist options
  • Save hunner/ea11d5a51ec0651bed5a0f0823225ce1 to your computer and use it in GitHub Desktop.
Save hunner/ea11d5a51ec0651bed5a0f0823225ce1 to your computer and use it in GitHub Desktop.
$file_defaults = {
mode => '0600',
owner => 'root',
group => 'root',
ensure => file,
}
file {'/etc/ssh_host_dsa_key':
* => $file_defaults,
}
file { '/etc/ssh_host_key':
* => $file_defaults,
}
# The old way of doing it
create_resources('file',{
'/etc/ssh_host_dsa_key' => {},
'/etc/ssh_host_dsa_key.pub'=> {
mode => '0644',
},
'/etc/ssh_host_key' => {},
'/etc/ssh_host_key.pub' => {
mode => '0644',
},
}, $file_defaults)
#Broken, but pretty
file { '/etc/ssh_host_dsa_key.pub':
mode => '0644',
* => $file_defaults,
}
# ugly, and still uses ;
file { default:
* => $file_defaults,
; '/etc/ssh_host_key.pub':
mode => '0644',
}
#or
file { '/etc/ssh_host_key.pub':
* => {
mode => '0644',
} + $file_defaults,
}
#or
file { '/etc/ssh_host_key.pub':
* => { mode => '0644' } + $file_defaults,
}
@rnelson0
Copy link

  concat {
    default:
      ensure => present,
    ;
    '/root/.ssh/authorized_keys':;
    '/etc/app/app.conf':;
  }
  # concat::fragments done through iteration later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment