diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2015-10-29 12:50:11 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2015-10-29 12:50:11 -0200 |
commit | 975fc65d3aeb153dd08770c8e9e7a727c3fbedda (patch) | |
tree | 20b4d0b089aa99763f5a55e6c2bbc117622e71aa | |
parent | 8df4bf9d9b43701d6fd580333a059656a93714dd (diff) | |
download | puppet-websites-975fc65d3aeb153dd08770c8e9e7a727c3fbedda.tar.gz puppet-websites-975fc65d3aeb153dd08770c8e9e7a727c3fbedda.tar.bz2 |
Adds websites::resources
-rw-r--r-- | manifests/init.pp | 27 | ||||
-rw-r--r-- | manifests/resources.pp | 28 |
2 files changed, 28 insertions, 27 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index ec6c0cf..1ff5869 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,31 +4,4 @@ class websites inherits websites::setup { mpm => false, tag => 'all', } - - # Retrieve configured instances - $sites = hiera('apache::sites', {}) - $databases = hiera('database::instances', {}) - $ikiwikis = hiera('ikiwiki::instances', {}) - $domains = hiera('domain_check::instances', {}) - - # Apply instances - create_resources('apache::site', $sites) - create_resources('database::instance', $databases) - create_resources('ikiwiki::instance', $ikiwikis) - create_resources('domain_check::instance', $domains) - - # Remove untagged site instances - Apache::Site <| tag != $::hostname and tag != 'all' |> { - ensure => absent, - } - - # Remove untagged database instances - Database::Instance <| tag != $::hostname and tag != 'all' |> { - ensure => absent, - } - - # Remove untagged ikiwiki instances - Ikiwiki::Instance <| tag != $::hostname and tag != 'all' |> { - ensure => absent, - } } diff --git a/manifests/resources.pp b/manifests/resources.pp new file mode 100644 index 0000000..5b4a19d --- /dev/null +++ b/manifests/resources.pp @@ -0,0 +1,28 @@ +class websites::resources { + # Retrieve configured instances + $sites = hiera('apache::sites', {}) + $databases = hiera('database::instances', {}) + $ikiwikis = hiera('ikiwiki::instances', {}) + $domains = hiera('domain_check::instances', {}) + + # Apply instances + create_resources('apache::site', $sites) + create_resources('database::instance', $databases) + create_resources('ikiwiki::instance', $ikiwikis) + create_resources('domain_check::instance', $domains) + + # Remove untagged site instances + Apache::Site <| tag != $::hostname and tag != 'all' |> { + ensure => absent, + } + + # Remove untagged database instances + Database::Instance <| tag != $::hostname and tag != 'all' |> { + ensure => absent, + } + + # Remove untagged ikiwiki instances + Ikiwiki::Instance <| tag != $::hostname and tag != 'all' |> { + ensure => absent, + } +} |