From 7b72fb3775a2d949e8b40a9ccb4cecb0c4dcdf03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Ole=C5=9B?= Date: Wed, 15 Jul 2015 12:59:45 +0000 Subject: [PATCH] Rabbitmq remove action and fixes --- example-puppet.py | 6 ++---- resources/rabbitmq_service/actions/remove.pp | 12 ++++++++++++ resources/rabbitmq_service/actions/run.pp | 2 +- resources/rabbitmq_service/meta.yaml | 7 ++++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/example-puppet.py b/example-puppet.py index 06f9689d..4f3d8c07 100644 --- a/example-puppet.py +++ b/example-puppet.py @@ -38,7 +38,6 @@ def deploy(): signals.Connections.clear() node1 = vr.create('node1', 'resources/ro_node/', {'ip': '10.0.0.3', 'ssh_key': '/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key', 'ssh_user': 'vagrant'})[0] - node2 = vr.create('node1', 'resources/ro_node/', {'ip': '10.0.0.4', 'ssh_key': '/vagrant/.vagrant/machines/solar-dev2/virtualbox/private_key', 'ssh_user': 'vagrant'})[0] # MARIADB mariadb_service1 = vr.create('mariadb_service1', 'resources/mariadb_service', {'image': 'mariadb', 'root_password': 'mariadb', 'port': 3306})[0] @@ -47,7 +46,6 @@ def deploy(): # RABBIT rabbitmq_service1 = vr.create('rabbitmq1', 'resources/rabbitmq_service', {'management_port': 15672, 'port': 5672, 'node_name': 'rabbitmq_service1'})[0] - rabbitmq_service2 = vr.create('rabbitmq1', '/home/vagrant/puppet-libs-resource/rabbitmq', {'management_port': 15672, 'port': 5672, 'node_name': 'rabbitmq_service2'})[0] openstack_vhost = vr.create('openstack_vhost', 'resources/rabbitmq_vhost/', {'vhost_name': 'openstack'})[0] openstack_rabbitmq_user = vr.create('openstack_rabbitmq_user', 'resources/rabbitmq_user/', {'user_name': 'openstack', 'password': 'openstack_password'})[0] @@ -242,11 +240,11 @@ def undeploy(): 'neutron_keystone_role', 'neutron_keystone_user', 'services_tenant', - 'keystone_service_endpoint', + #'keystone_service_endpoint', 'admin_role', 'admin_user', 'admin_tenant', - 'openrc', + 'openrc_file', 'keystone_puppet', 'keystone_db_user', 'keystone_db', diff --git a/resources/rabbitmq_service/actions/remove.pp b/resources/rabbitmq_service/actions/remove.pp index e69de29b..1047bc46 100644 --- a/resources/rabbitmq_service/actions/remove.pp +++ b/resources/rabbitmq_service/actions/remove.pp @@ -0,0 +1,12 @@ +$resource = hiera($::resource_name) + +$node_name = $resource['input']['node_name']['value'] + +class { '::rabbitmq': + package_ensure => 'absent', + environment_variables => { + 'RABBITMQ_NODENAME' => $node_name, + 'RABBITMQ_SERVICENAME' => 'RabbitMQ' + } +} + diff --git a/resources/rabbitmq_service/actions/run.pp b/resources/rabbitmq_service/actions/run.pp index 658f66f8..807f93bd 100644 --- a/resources/rabbitmq_service/actions/run.pp +++ b/resources/rabbitmq_service/actions/run.pp @@ -1,4 +1,4 @@ -$resource = hiera('{{ resource_name }}') +$resource = hiera($::resource_name) $port = "${resource['input']['port']['value']}" $management_port = "${resource['input']['management_port']['value']}" diff --git a/resources/rabbitmq_service/meta.yaml b/resources/rabbitmq_service/meta.yaml index 52f8e526..69ef8a08 100644 --- a/resources/rabbitmq_service/meta.yaml +++ b/resources/rabbitmq_service/meta.yaml @@ -4,15 +4,16 @@ input: ip: schema: str! value: '' - node_name: - schema: str! - value: 'node1' ssh_key: schema: str! value: '' ssh_user: schema: str! value: '' + + node_name: + schema: str! + value: 'node1' port: schema: int! value: ''