Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Code
- define foo(){
- exec { "${name}_exec":
- command => "echo hello ${name}",
- path => '/bin:/usr/bin',
- refreshonly => true,
- logoutput => true,
- }
- anchor { 'foo_begin':
- subscribe => Exec["${name}_exec"]
- }
- file { "${name}_file":
- path => "/tmp/${name}",
- content => "Test file for ${name}\n",
- ensure => file,
- subscribe => Exec["${name}_exec"]
- }
- ->
- notify {'Notify_works':}
- anchor { 'foo_end':
- notify => Notify['foo_done']
- }
- notify { 'foo_done':
- message => "Foo is done"
- }
- }
- ...
- class act::server::linux::db::oracle inherits act::server::linux {
- # Check if oracle is installed. If not, install it.
- if !$::oracle_installed {
- notify {'oracle_not_installed':
- message => "Oracle is not installed. Installing..."}
- # Check if Oracle Version required is defined. Fail if not.
- if $::oracle_version == undef {
- fail("oracle_version is not defined.")
- } else {
- # Include the act::env::oracle class to setup and install oracle.
- class {'act::env::oracle':
- version => $::oracle_version,
- }
- }
- } else {
- notify {'oracle_installed':
- message => "Oracle $::oracle_version is already installed. Skipping."}
- }
- foo { 'bar': }
- # Test file
- file { 'test_ora_file':
- ensure => file,
- content => "Test ora file\n",
- path => '/tmp/ora_file',
- notify => Foo['bar']
- }
- }
- -- Log
- Oracle 11.2.0.3 is already installed. Skipping.
- /Stage[main]/Act::Server::Linux::Db::Oracle/Notify[oracle_installed]/message: defined 'message' as 'Oracle 11.2.0.3 is already installed. Skipping.'
- Foo is done
- /Stage[main]/Act::Server::Linux::Db::Oracle/Foo[bar]/Notify[foo_done]/message: defined 'message' as 'Foo is done'
- Notify_works
- /Stage[main]/Act::Server::Linux::Db::Oracle/Foo[bar]/Notify[Notify_works]/message: defined 'message' as 'Notify_works'
- Environment = production
- /Stage[main]//Notify[environment]/message: defined 'message' as 'Environment = production'
- Finished catalog run in 1.52 seconds
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement