added anchor pattern
This commit is contained in:
parent
9c9b5c2c78
commit
b9aac9292e
4 changed files with 37 additions and 15 deletions
|
@ -6,3 +6,5 @@ license 'Apache License Version 2.0'
|
||||||
summary 'Puppet NGINX management module'
|
summary 'Puppet NGINX management module'
|
||||||
description 'This module can be used for basic NGINX Management'
|
description 'This module can be used for basic NGINX Management'
|
||||||
project_page 'http://github.com/puppetlabs/puppetlabs-nginx'
|
project_page 'http://github.com/puppetlabs/puppetlabs-nginx'
|
||||||
|
|
||||||
|
dependency 'puppetlabs/stdlib', '>= 0.1.6'
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# Actions:
|
# Actions:
|
||||||
#
|
#
|
||||||
# Requires:
|
# Requires:
|
||||||
|
# puppetlabs-stdlib - https://github.com/puppetlabs/puppetlabs-stdlib
|
||||||
#
|
#
|
||||||
# Packaged NGINX
|
# Packaged NGINX
|
||||||
# - RHEL: EPEL or custom package
|
# - RHEL: EPEL or custom package
|
||||||
|
@ -25,15 +26,25 @@
|
||||||
# }
|
# }
|
||||||
class nginx {
|
class nginx {
|
||||||
|
|
||||||
include nginx::package
|
class { 'stdlib': }
|
||||||
include nginx::config
|
|
||||||
include nginx::service
|
|
||||||
|
|
||||||
Class['nginx::package'] -> Class['nginx::config'] ~> Class['nginx::service']
|
anchor{ 'nginx::begin':
|
||||||
|
before => Class['nginx::package'],
|
||||||
|
notify => Class['nginx::service'],
|
||||||
|
}
|
||||||
|
|
||||||
# Allow the end user to establish relationships to the "main" class
|
class { 'nginx::package':
|
||||||
# and preserve the relationship to the implementation classes through
|
notify => Class['nginx::service'],
|
||||||
# a transitive relationship to the composite class.
|
}
|
||||||
Class['nginx::service'] -> Class['nginx']
|
|
||||||
|
|
||||||
|
class { 'nginx::config':
|
||||||
|
require => Class['nginx::package'],
|
||||||
|
notify => Class['nginx::service'],
|
||||||
|
}
|
||||||
|
|
||||||
|
class { 'nginx::service': }
|
||||||
|
|
||||||
|
anchor { 'nginx::end':
|
||||||
|
require => Class['nginx::service'],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,15 +14,27 @@
|
||||||
#
|
#
|
||||||
# This class file is not called directly
|
# This class file is not called directly
|
||||||
class nginx::package {
|
class nginx::package {
|
||||||
|
anchor { 'nginx::package::begin': }
|
||||||
|
anchor { 'nginx::package::end': }
|
||||||
|
|
||||||
case $operatingsystem {
|
case $operatingsystem {
|
||||||
centos,fedora,rhel: {
|
centos,fedora,rhel: {
|
||||||
include nginx::package::redhat
|
class { 'nginx::package::redhat':
|
||||||
|
require => Anchor['nginx::package::begin'],
|
||||||
|
before => Anchor['nginx::package::end'],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
debian,ubuntu: {
|
debian,ubuntu: {
|
||||||
include nginx::package::debian
|
class { 'nginx::package::debian':
|
||||||
|
require => Anchor['nginx::package::begin'],
|
||||||
|
before => Anchor['nginx::package::end'],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
opensuse,suse: {
|
opensuse,suse: {
|
||||||
include nginx::package::suse
|
class { 'nginx::package::suse':
|
||||||
|
require => Anchor['nginx::package::begin'],
|
||||||
|
before => Anchor['nginx::package::end'],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,5 @@ class nginx::service {
|
||||||
enable => true,
|
enable => true,
|
||||||
hasstatus => true,
|
hasstatus => true,
|
||||||
hasrestart => true,
|
hasrestart => true,
|
||||||
subscribe => Class['nginx'],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Exec['rebuild-nginx-vhosts'] ~> Service['nginx']
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue