X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Fmanifests%2Fpubsub.pp;h=20554ece2b21152b5b05ea3f93b66e4332bfb035;hb=e7fec35f88f5958af2e23a677912f6360e4c66bb;hp=b48097e0dafc094a3d7fa77e027da00abeb47445;hpb=29ce6770a6757e8ea59ad7a9bb37c0cb441d3428;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/manifests/pubsub.pp b/modules/roles/manifests/pubsub.pp index b48097e0d..20554ece2 100644 --- a/modules/roles/manifests/pubsub.pp +++ b/modules/roles/manifests/pubsub.pp @@ -1,2 +1,41 @@ class roles::pubsub { + include roles::pubsub::params + include roles::pubsub::entities + + $cluster_cookie = $roles::pubsub::params::cluster_cookie + + # Get the fact named hostname from all nodes in puppetdb with class Roles::Pubsub + $query = 'facts { name = "hostname" and resources { type = "Class" and title = "Roles::Pubsub" } }' + $cluster_nodes = sort(puppetdb_query($query).map |$value| { $value["value"] }) + + class { 'rabbitmq': + config_cluster => true, + cluster_nodes => $cluster_nodes, + cluster_node_type => 'disc', + erlang_cookie => '8r17so6o1s124ns49sr08n0o24342160', + delete_guest_user => true, + ssl => true, + ssl_cacert => '/etc/ssl/debian/certs/ca.crt', + ssl_cert => '/etc/ssl/debian/certs/thishost-server.crt', + ssl_key => '/etc/ssl/private/thishost-server.key', + ssl_port => 5671, + ssl_verify => 'verify_none', + repos_ensure => false, + } + + user { 'rabbitmq': + groups => 'ssl-cert' + } + + ferm::rule { 'rabbitmq': + description => 'rabbitmq connections', + domain => '(ip ip6)', + rule => '&SERVICE_RANGE(tcp, 5671, $HOST_DEBIAN)' + } + + @@ferm::rule::simple { "pubsub-cluster-from-${::fqdn}": + tag => 'roles::pubsub::intra-cluster', + saddr => $base::public_addresses, + } + Ferm::Rule::Simple <<| tag == 'roles::pubsub::intra-cluster' |>> }