Ask Your Question
0

apt::source, hiera, calling_module, how to combine

asked 2017-03-30 06:06:08 -0500

puppetdude gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-03-31 07:09:33 -0500

DarylW gravatar image

What I would do in your situation is to have the profile that you know has rabitmq being installed manage the apt::sources. I would assume that it isn't a 'surprise' which servers get it installed, correct?

edit flag offensive delete link more

Comments

I've been thinking about it, but it looks ugly for me, coz when I decide to change package version or remove package from role I have to look in two separate modules. I'm trying too make my modules as independent as possible.

puppetdude gravatar imagepuppetdude ( 2017-03-31 09:22:10 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-03-30 06:05:08 -0500

Seen: 32 times

Last updated: Mar 31