commit
fbfe8bbc33
@ -39,13 +39,16 @@ def deploy():
|
||||
|
||||
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]
|
||||
|
||||
rabbitmq_service1 = vr.create('rabbitmq_service1', 'resources/rabbitmq_service/', {'management_port': 15672, 'port': 5672, 'container_name': 'rabbitmq_service1', 'image': 'rabbitmq:3-management'})[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]
|
||||
|
||||
# MARIADB
|
||||
mariadb_service1 = vr.create('mariadb_service1', 'resources/mariadb_service', {'image': 'mariadb', 'root_password': 'mariadb', 'port': 3306})[0]
|
||||
|
||||
signals.connect(node1, mariadb_service1)
|
||||
|
||||
# RABBIT
|
||||
rabbitmq_service1 = vr.create('rabbitmq1', 'resources/rabbitmq_service', {'management_port': 15672, 'port': 5672, 'node_name': 'rabbitmq_service1'})[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]
|
||||
|
||||
signals.connect(node1, rabbitmq_service1)
|
||||
signals.connect(rabbitmq_service1, openstack_vhost)
|
||||
signals.connect(rabbitmq_service1, openstack_rabbitmq_user)
|
||||
@ -62,12 +65,6 @@ def deploy():
|
||||
admin_role = vr.create('admin_role', 'resources/keystone_role', {'role_name': 'admin'})[0]
|
||||
services_tenant = vr.create('services_tenant', 'resources/keystone_tenant', {'tenant_name': 'services'})[0]
|
||||
|
||||
signals.connect(node1, rabbitmq_service1)
|
||||
signals.connect(rabbitmq_service1, openstack_vhost)
|
||||
signals.connect(rabbitmq_service1, openstack_rabbitmq_user)
|
||||
signals.connect(openstack_vhost, openstack_rabbitmq_user, {'vhost_name': 'vhost_name'})
|
||||
|
||||
signals.connect(node1, mariadb_service1)
|
||||
signals.connect(node1, keystone_db)
|
||||
signals.connect(node1, keystone_db_user)
|
||||
signals.connect(node1, keystone_puppet)
|
||||
@ -92,12 +89,19 @@ def deploy():
|
||||
signals.connect(keystone_db, keystone_puppet, {'db_name': 'db_name'})
|
||||
signals.connect(keystone_db_user, keystone_puppet, {'new_user_name': 'db_user', 'new_user_password': 'db_password'})
|
||||
|
||||
# OPENRC
|
||||
openrc = vr.create('openrc_file', 'resources/openrc_file', {})[0]
|
||||
|
||||
signals.connect(node1, openrc)
|
||||
signals.connect(keystone_puppet, openrc, {'ip': 'keystone_host', 'admin_port':'keystone_port'})
|
||||
signals.connect(admin_user, openrc, {'user_name': 'user_name','user_password':'password', 'tenant_name': 'tenant'})
|
||||
|
||||
# NEUTRON
|
||||
# TODO: vhost cannot be specified in neutron Puppet manifests so this user has to be admin anyways
|
||||
neutron_puppet = vr.create('neutron_puppet', 'resources/neutron_puppet', {'rabbitmq_user': 'guest', 'rabbitmq_password': 'guest'})[0]
|
||||
|
||||
neutron_keystone_user = vr.create('neutron_keystone_user', 'resources/keystone_user', {'user_name': 'neutron', 'user_password': 'neutron'})[0]
|
||||
neutron_keystone_role = vr.create('neutron_keystone_role', 'resources/keystone_role', {'role_name': 'neutron'})[0]
|
||||
neutron_keystone_role = vr.create('neutron_keystone_role', 'resources/keystone_role', {'role_name': 'neutron'})[0]
|
||||
neutron_keystone_service_endpoint = vr.create('neutron_keystone_service_endpoint', 'resources/keystone_service_endpoint', {'endpoint_name': 'neutron', 'adminurl': 'http://{{admin_ip}}:{{admin_port}}', 'internalurl': 'http://{{internal_ip}}:{{internal_port}}', 'publicurl': 'http://{{public_ip}}:{{public_port}}', 'description': 'OpenStack Network Service', 'type': 'network'})[0]
|
||||
|
||||
signals.connect(node1, neutron_puppet)
|
||||
@ -195,6 +199,7 @@ def deploy():
|
||||
actions.resource_action(keystone_db, 'run')
|
||||
actions.resource_action(keystone_db_user, 'run')
|
||||
actions.resource_action(keystone_puppet, 'run')
|
||||
actions.resource_action(openrc, 'run')
|
||||
|
||||
actions.resource_action(admin_tenant, 'run')
|
||||
actions.resource_action(admin_user, 'run')
|
||||
@ -235,17 +240,18 @@ def undeploy():
|
||||
'neutron_keystone_role',
|
||||
'neutron_keystone_user',
|
||||
'services_tenant',
|
||||
'keystone_service_endpoint',
|
||||
#'keystone_service_endpoint',
|
||||
'admin_role',
|
||||
'admin_user',
|
||||
'admin_tenant',
|
||||
'openrc_file',
|
||||
'keystone_puppet',
|
||||
'keystone_db_user',
|
||||
'keystone_db',
|
||||
'mariadb_service1',
|
||||
'openstack_rabbitmq_user',
|
||||
'openstack_vhost',
|
||||
'rabbitmq_service1',
|
||||
'rabbitmq1',
|
||||
]
|
||||
|
||||
resources = map(resource.wrap_resource, db.get_list(collection=db.COLLECTIONS.resource))
|
||||
@ -283,7 +289,7 @@ def undeploy():
|
||||
|
||||
# actions.resource_action(resources['openstack_rabbitmq_user'], 'remove')
|
||||
# actions.resource_action(resources['openstack_vhost'], 'remove')
|
||||
# actions.resource_action(resources['rabbitmq_service1'], 'remove')
|
||||
# actions.resource_action(resources['rabbitmq1'], 'remove')
|
||||
|
||||
db.clear()
|
||||
|
||||
|
12
resources/rabbitmq_service/actions/remove.pp
Normal file
12
resources/rabbitmq_service/actions/remove.pp
Normal file
@ -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'
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
- hosts: [{{ ip }}]
|
||||
sudo: yes
|
||||
tasks:
|
||||
- name: rabbitmq container
|
||||
docker:
|
||||
name: {{ container_name }}
|
||||
image: {{ image }}
|
||||
state: absent
|
16
resources/rabbitmq_service/actions/run.pp
Normal file
16
resources/rabbitmq_service/actions/run.pp
Normal file
@ -0,0 +1,16 @@
|
||||
$resource = hiera($::resource_name)
|
||||
|
||||
$port = "${resource['input']['port']['value']}"
|
||||
$management_port = "${resource['input']['management_port']['value']}"
|
||||
$node_name = $resource['input']['node_name']['value']
|
||||
|
||||
class { '::rabbitmq':
|
||||
service_manage => false,
|
||||
port => $port,
|
||||
management_port => $management_port,
|
||||
delete_guest_user => true,
|
||||
environment_variables => {
|
||||
'RABBITMQ_NODENAME' => $node_name,
|
||||
'RABBITMQ_SERVICENAME' => 'RabbitMQ'
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
- hosts: [{{ ip }}]
|
||||
sudo: yes
|
||||
tasks:
|
||||
- name: rabbitmq container
|
||||
docker:
|
||||
command: /bin/bash -c rabbitmq-server
|
||||
name: {{ container_name }}
|
||||
image: {{ image }}
|
||||
state: running
|
||||
expose:
|
||||
- 5672
|
||||
- 15672
|
||||
ports:
|
||||
- {{ port }}:5672
|
||||
- {{ management_port }}:15672
|
||||
env:
|
||||
RABBITMQ_NODENAME: {{container_name}}
|
||||
- shell: docker exec -t {{ container_name }} rabbitmqctl list_users
|
||||
register: result
|
||||
until: result.rc == 0
|
||||
retries: 20
|
||||
delay: 0.5
|
@ -1,27 +1,29 @@
|
||||
id: rabbitmq_service
|
||||
handler: ansible
|
||||
version: 1.0.0
|
||||
handler: puppet
|
||||
id: 'rabbitmq'
|
||||
input:
|
||||
image:
|
||||
schema: str!
|
||||
value: rabbitmq:3-management
|
||||
container_name:
|
||||
schema: str!
|
||||
value: rabbitmq_service
|
||||
management_port:
|
||||
schema: int!
|
||||
value: 15672
|
||||
port:
|
||||
schema: int!
|
||||
value: 5672
|
||||
ip:
|
||||
schema: str!
|
||||
value:
|
||||
ssh_key:
|
||||
schema: str!
|
||||
value:
|
||||
ssh_user:
|
||||
schema: str!
|
||||
value:
|
||||
ip:
|
||||
schema: str!
|
||||
value: ''
|
||||
ssh_key:
|
||||
schema: str!
|
||||
value: ''
|
||||
ssh_user:
|
||||
schema: str!
|
||||
value: ''
|
||||
|
||||
tags: [resources/rabbitmq, resource/rabbitmq_service]
|
||||
node_name:
|
||||
schema: str!
|
||||
value: 'node1'
|
||||
port:
|
||||
schema: int!
|
||||
value: ''
|
||||
management_port:
|
||||
schema: int!
|
||||
value: ''
|
||||
git:
|
||||
schema: {repository: str!, branch: str!}
|
||||
value: {repository: 'https://github.com/puppetlabs/puppetlabs-rabbitmq.git', branch: '5.1.0'}
|
||||
|
||||
puppet_module: 'rabbitmq'
|
||||
tags: []
|
||||
version: 1.0.0
|
||||
|
@ -1 +0,0 @@
|
||||
{{erlang_cookie}}
|
@ -1,9 +0,0 @@
|
||||
import requests
|
||||
|
||||
from solar.core.log import log
|
||||
|
||||
|
||||
def test(resource):
|
||||
log.debug('Testing rabbitmq_service')
|
||||
|
||||
requests.get('http://%s:%s' % (resource.args['ip'].value, resource.args['management_port'].value))
|
@ -4,5 +4,4 @@
|
||||
- new_rabbitmq_user: user={{user_name}}
|
||||
vhost={{vhost_name}}
|
||||
state=absent
|
||||
node={{container_name}}
|
||||
rabbitmqctl="docker exec -it {{container_name}} rabbitmqctl"
|
||||
node={{node_name}}
|
||||
|
@ -8,5 +8,4 @@
|
||||
read_priv=.*
|
||||
write_priv=.*
|
||||
state=present
|
||||
node={{container_name}}
|
||||
rabbitmqctl="docker exec -it {{container_name}} rabbitmqctl"
|
||||
node={{node_name}}
|
||||
|
@ -2,7 +2,7 @@ id: rabbitmq_user
|
||||
handler: ansible
|
||||
version: 1.0.0
|
||||
input:
|
||||
container_name:
|
||||
node_name:
|
||||
schema: str!
|
||||
value:
|
||||
user_name:
|
||||
|
@ -3,5 +3,4 @@
|
||||
tasks:
|
||||
- new_rabbitmq_vhost: name={{vhost_name}}
|
||||
state=absent
|
||||
rabbitmqctl="docker exec -it {{container_name}} rabbitmqctl"
|
||||
node={{container_name}}
|
||||
node={{node_name}}
|
||||
|
@ -2,6 +2,5 @@
|
||||
sudo: yes
|
||||
tasks:
|
||||
- new_rabbitmq_vhost: name={{vhost_name}}
|
||||
node={{container_name}}
|
||||
node={{node_name}}
|
||||
state=present
|
||||
rabbitmqctl="docker exec -it {{container_name}} rabbitmqctl"
|
||||
|
@ -2,7 +2,7 @@ id: rabbitmq_vhost
|
||||
handler: ansible
|
||||
version: 1.0.0
|
||||
input:
|
||||
container_name:
|
||||
node_name:
|
||||
schema: str!
|
||||
value:
|
||||
vhost_name:
|
||||
|
Loading…
x
Reference in New Issue
Block a user