puppet-openstack-cookiecutter/puppet-{{cookiecutter.project_name}}/manifests/deps.pp
Takashi Kajinami 8fe204a3f0 Refactor resource dependencies
This refactors resource dependencies to avoid unnecessary dependencies
across services.

Change-Id: I0f0c12f77eb39cb1d1c68fe2b02050ada257aabb
2024-04-08 11:18:39 +09:00

34 lines
1.8 KiB
Puppet

# == Class: {{cookiecutter.project_name}}::deps
#
# {{cookiecutter.project_name}} anchors and dependency management
#
class {{cookiecutter.project_name}}::deps {
assert_private()
# Setup anchors for install, config and service phases of the module. These
# anchors allow external modules to hook the begin and end of any of these
# phases. Package or service management can also be replaced by ensuring the
# package is absent or turning off service management and having the
# replacement depend on the appropriate anchors. When applicable, end tags
# should be notified so that subscribers can determine if installation,
# config or service state changed and act on that if needed.
anchor { '{{cookiecutter.project_name}}::install::begin': }
-> Package<| tag == '{{cookiecutter.project_name}}-package'|>
~> anchor { '{{cookiecutter.project_name}}::install::end': }
-> anchor { '{{cookiecutter.project_name}}::config::begin': }
-> {{cookiecutter.project_name|capitalize}}_config<||>
~> anchor { '{{cookiecutter.project_name}}::config::end': }
-> anchor { '{{cookiecutter.project_name}}::db::begin': }
-> anchor { '{{cookiecutter.project_name}}::db::end': }
~> anchor { '{{cookiecutter.project_name}}::dbsync::begin': }
-> anchor { '{{cookiecutter.project_name}}::dbsync::end': }
~> anchor { '{{cookiecutter.project_name}}::service::begin': }
~> Service<| tag == '{{cookiecutter.project_name}}-service' |>
~> anchor { '{{cookiecutter.project_name}}::service::end': }
# Installation or config changes will always restart services.
Anchor['{{cookiecutter.project_name}}::install::end'] ~> Anchor['{{cookiecutter.project_name}}::service::begin']
Anchor['{{cookiecutter.project_name}}::config::end'] ~> Anchor['{{cookiecutter.project_name}}::service::begin']
}