Search code examples
rabbitmqpuppetrabbitmq-exchange

How do I configure rabbitmq queue via puppet


I'm trying to install rabbitmq via puppet. I'm using the puppetlabs-rabbitmq module. It also has section to configure queues and exchanges, which are Native Types. I can't figure out how to use these native types.

My code for rabbitmq installation:

class rabbitmq-concrete{

  $tools = ["vim-enhanced","mc"]
  package { $tools: ensure => "installed" }

  $interface = "enp0s8"
  $address = inline_template("<%= scope.lookupvar('::ipaddress_${interface}') -%>")

  class { 'rabbitmq':
    config_cluster    => true,
    cluster_nodes     => ['rml01', 'rml02'],
    cluster_node_type => 'disc',
    manage_repos => true,
    node_ip_address => $address,
    erlang_cookie => 'rmq_secret',
  }
    rabbitmq_exchange { "logging@${node_name}":
      type     => 'topic',
      ensure   => present,
    }

    rabbitmq_queue { "logging@${node_name}":
      durable     => true,
      auto_delete => false,
      arguments   => {
        x-message-ttl => 123,
        x-dead-letter-exchange => 'other'
      },
     ensure      => present,
    }

    rabbitmq_binding { "logging@logging@${node_name}":
      destination_type => 'logging',
      routing_key      => '#',
      arguments        => {},
      ensure           => present,
    }
}
include rabbitmq-concrete

I get following error:

==> rml01: Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type rabbitmq_queue at /tmp/vagrant-puppet-2/manifests/site.pp:35 on node rml01
==> rml01: Wrapped exception:
==> rml01: Invalid resource type rabbitmq_queue
==> rml01: Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type rabbitmq_queue at /tmp/vagrant-puppet-2/manifests/site.pp:35 on node rml01

Note: When I leave out these native types, rabbit installation works well.

How do I use Native Types to configure rabbitmq_queue, rabbitmq_exchange and rabbitmq_binding ?


Solution

  • Do you have the required prerequisites? You need the following packages from the Forge:

    puppetlabs/stdlib
    stahnma/epel
    nanliu/staging
    garethr/erlang

    To your manifest I added:

    include epel
    include staging
    class { 'erlang': epel_enable => true}