I' m struggling for about two weeks to figure out how to implement following scenario:
Let' s say I have a module that installs and configures rabbitmq. Since I need package version that is not present in distro repository, I want to add one, by using puppetlabs-apt module, but I want to keep all my variables in hiera and use this repo inly if rabbitmq is installed.
hiera.yaml
:hierarchy:
- "nodes/%{::fqdn}"
- "nodes/%{::lsbdistcodename}"
- "%{calling_module}"
- "common"
:backends:
- yaml
:yaml:
:datadir: '/etc/puppet/hiera'
package.pp
require apt
package {'rabbitmq-server':
ensure => 'present',
}
rabbitmq.yaml
apt::sources:
'rabbitmq':
comment: 'RabbitMQ Official Repository'
location: 'http://www.rabbitmq.com/debian/'
release: 'testing'
repos: 'main'
key:
source: 'https://www.rabbitmq.com/rabbitmq-release-signing-key.asc'
id: '0A9AF2115F4687BD29803A206B73A36E6026DFCA'
include:
deb: true
This doesn't work because calling_module is apt and it doesnt search for variables in rabbitmq.yaml and defaults to common where I define repos for all roles. How can I achieve my goals. Any Ideas?
↧