Merge pull request #254 from loles/librarian

Move to Librarian
This commit is contained in:
Jędrzej Nowak 2015-10-20 18:21:16 +02:00
commit bf80423ab7
11 changed files with 386 additions and 311 deletions

View File

@ -1,18 +1,19 @@
id: librarian_examples id: librarian_examples
resources: resources:
- id: rabbitmq_service1
from: resources/rabbitmq_service
location: {{node}}
values:
management_port: 15672
port: 5672
- id: librarian - id: librarian
location: {{node}} location: {{node}}
from: resources/librarian from: resources/librarian
values: values:
modules_path: /tmp/x/x/modules
modules: modules:
- name: puppetlabs-ntp - rabbitmq_service1::module::NO_EVENTS
version: 4.1.0
- name: puppet-keystone
type: git
url: https://github.com/openstack/puppet-keystone
ref: 5.1.0
events: events:
- type: depends_on - type: depends_on

View File

@ -2,14 +2,11 @@
import click import click
import sys import sys
import time
from solar.core import actions
from solar.core import resource from solar.core import resource
from solar.core import signals from solar.core import signals
from solar.core import validation from solar.core import validation
from solar.core.resource import virtual_resource as vr from solar.core.resource import virtual_resource as vr
from solar import errors
from solar import events as evapi from solar import events as evapi
from solar.interfaces.db import get_db from solar.interfaces.db import get_db
@ -25,9 +22,7 @@ if PROFILE:
import pstats import pstats
pr = cProfile.Profile() pr = cProfile.Profile()
pr.enable()
GIT_PUPPET_LIBS_URL = 'https://github.com/CGenie/puppet-libs-resource'
# TODO # TODO
@ -36,7 +31,7 @@ GIT_PUPPET_LIBS_URL = 'https://github.com/CGenie/puppet-libs-resource'
# To discuss: install stuff in Docker container # To discuss: install stuff in Docker container
# NOTE # NOTE
# No copy of manifests, pull from upstream (implemented in the puppet handler) # No copy of manifests, pull from upstream (implemented in the librarian resource)
# Official puppet manifests, not fuel-library # Official puppet manifests, not fuel-library
@ -48,12 +43,9 @@ def main():
pass pass
def setup_resources(): def setup_base():
db.clear() db.clear()
if PROFILE:
pr.enable()
resources = vr.create('nodes', 'templates/nodes_with_transports.yaml', {"count": 2}) resources = vr.create('nodes', 'templates/nodes_with_transports.yaml', {"count": 2})
nodes = [x for x in resources if x.name.startswith('node')] nodes = [x for x in resources if x.name.startswith('node')]
node1, node2 = nodes node1, node2 = nodes
@ -61,22 +53,33 @@ def setup_resources():
nodes_sdn = [x for x in resources if x.name.startswith('node')] nodes_sdn = [x for x in resources if x.name.startswith('node')]
node1_sdn, node2_sdn = nodes_sdn node1_sdn, node2_sdn = nodes_sdn
# LIBRARIAN
librarian_node1 = vr.create('librarian_node1', 'resources/librarian', {})[0]
librarian_node2 = vr.create('librarian_node2', 'resources/librarian', {})[0]
node1.connect(librarian_node1, {})
node2.connect(librarian_node2, {})
# NETWORKING # NETWORKING
# TODO(bogdando) node's IPs should be populated as br-mgmt IPs, but now are hardcoded in templates # TODO(bogdando) node's IPs should be populated as br-mgmt IPs, but now are hardcoded in templates
signals.connect(node1, node1_sdn) signals.connect(node1, node1_sdn)
node1_sdn.connect_with_events(librarian_node1, {'module': 'modules'}, {})
evapi.add_dep(librarian_node1.name, node1_sdn.name, actions=('run',))
signals.connect(node2, node2_sdn) signals.connect(node2, node2_sdn)
node2_sdn.connect_with_events(librarian_node2, {'module': 'modules'}, {})
evapi.add_dep(librarian_node2.name, node2_sdn.name, actions=('run',))
# MARIADB # MARIADB
mariadb_service1 = vr.create('mariadb_service1', 'resources/mariadb_service', { mariadb_service = vr.create('mariadb_service1', 'resources/mariadb_service', {
'image': 'mariadb', 'image': 'mariadb',
'port': 3306 'port': 3306
})[0] })[0]
signals.connect(node1, mariadb_service1) node1.connect(mariadb_service)
# RABBIT # RABBIT
rabbitmq_service1 = vr.create('rabbitmq_service1', 'resources/rabbitmq_service/', { rabbitmq_service = vr.create('rabbitmq_service1', 'resources/rabbitmq_service/', {
'management_port': 15672, 'management_port': 15672,
'port': 5672, 'port': 5672,
})[0] })[0]
@ -89,16 +92,32 @@ def setup_resources():
'password': 'openstack_password' 'password': 'openstack_password'
})[0] })[0]
signals.connect(node1, rabbitmq_service1) node1.connect(rabbitmq_service)
signals.connect(rabbitmq_service1, openstack_vhost) rabbitmq_service.connect_with_events(librarian_node1, {'module': 'modules'}, {})
signals.connect(rabbitmq_service1, openstack_rabbitmq_user) evapi.add_dep(librarian_node1.name, rabbitmq_service.name, actions=('run',))
signals.connect(openstack_vhost, openstack_rabbitmq_user, { rabbitmq_service.connect(openstack_vhost)
rabbitmq_service.connect(openstack_rabbitmq_user)
openstack_vhost.connect(openstack_rabbitmq_user, {
'vhost_name', 'vhost_name',
}) })
return {'node1': node1,
'node2': node2,
'node1_sdn': node1_sdn,
'node2_sdn': node2_sdn,
'librarian_node1': librarian_node1,
'librarian_node2': librarian_node2,
'mariadb_service': mariadb_service,
'rabbitmq_service1': rabbitmq_service,
'openstack_vhost': openstack_vhost,
'openstack_rabbitmq_user': openstack_rabbitmq_user}
# KEYSTONE def setup_keystone(node, librarian, mariadb_service, openstack_rabbitmq_user):
keystone_puppet = vr.create('keystone_puppet', 'resources/keystone_puppet', {})[0] keystone_puppet = vr.create('keystone_puppet', 'resources/keystone_puppet', {})[0]
evapi.add_dep(rabbitmq_service1.name, keystone_puppet.name, actions=('run', 'update'))
keystone_puppet.connect_with_events(librarian, {'module': 'modules'}, {})
evapi.add_dep(librarian.name, keystone_puppet.name, actions=('run',))
evapi.add_dep(openstack_rabbitmq_user.name, keystone_puppet.name, actions=('run', 'update'))
keystone_db = vr.create('keystone_db', 'resources/mariadb_db/', { keystone_db = vr.create('keystone_db', 'resources/mariadb_db/', {
'db_name': 'keystone_db', 'db_name': 'keystone_db',
'login_user': 'root' 'login_user': 'root'
@ -133,16 +152,16 @@ def setup_resources():
'role_name': 'admin' 'role_name': 'admin'
})[0] })[0]
signals.connect(node1, keystone_db) node.connect(keystone_db)
signals.connect(node1, keystone_db_user) node.connect(keystone_db_user)
signals.connect(node1, keystone_puppet) node.connect(keystone_puppet)
signals.connect(mariadb_service1, keystone_db, { mariadb_service.connect(keystone_db, {
'port': 'login_port', 'port': 'login_port',
'root_user': 'login_user', 'root_user': 'login_user',
'root_password': 'login_password', 'root_password': 'login_password',
'ip' : 'db_host', 'ip' : 'db_host',
}) })
signals.connect(keystone_db, keystone_db_user, { keystone_db.connect(keystone_db_user, {
'db_name', 'db_name',
'login_port', 'login_port',
'login_user', 'login_user',
@ -150,66 +169,95 @@ def setup_resources():
'db_host' 'db_host'
}) })
signals.connect(node1, keystone_service_endpoint) node.connect(keystone_service_endpoint)
signals.connect(keystone_puppet, keystone_service_endpoint, { keystone_puppet.connect(keystone_service_endpoint, {
'admin_token': 'admin_token', 'admin_token': 'admin_token',
'admin_port': ['admin_port', 'keystone_admin_port'], 'admin_port': ['admin_port', 'keystone_admin_port'],
'ip': ['keystone_host', 'admin_ip', 'internal_ip', 'public_ip'], 'ip': ['keystone_host', 'admin_ip', 'internal_ip', 'public_ip'],
'port': ['internal_port', 'public_port'], 'port': ['internal_port', 'public_port'],
}) })
signals.connect(keystone_puppet, admin_tenant) keystone_puppet.connect(admin_tenant)
signals.connect(keystone_puppet, admin_tenant, { keystone_puppet.connect(admin_tenant, {
'admin_port': 'keystone_port', 'admin_port': 'keystone_port',
'ip': 'keystone_host' 'ip': 'keystone_host'
}) })
signals.connect(admin_tenant, admin_user) admin_tenant.connect(admin_user)
signals.connect(admin_user, admin_role) admin_user.connect(admin_role)
signals.connect(admin_user, admin_role_services) admin_tenant.connect(admin_role, { 'tenant_name' })
signals.connect(services_tenant, admin_role_services, { 'tenant_name' })
signals.connect(keystone_puppet, services_tenant) admin_user.connect(admin_role_services)
signals.connect(keystone_puppet, services_tenant, { services_tenant.connect(admin_role_services, { 'tenant_name' })
keystone_puppet.connect(services_tenant)
keystone_puppet.connect(services_tenant, {
'admin_port': 'keystone_port', 'admin_port': 'keystone_port',
'ip': 'keystone_host' 'ip': 'keystone_host'
}) })
signals.connect(keystone_db, keystone_puppet, { keystone_db.connect(keystone_puppet, {
'db_name', 'db_name',
}) })
signals.connect(keystone_db_user, keystone_puppet, { keystone_db_user.connect(keystone_puppet, {
'user_name': 'db_user', 'user_name': 'db_user',
'user_password': 'db_password', 'user_password': 'db_password',
'db_host' : 'db_host' 'db_host' : 'db_host'
}) })
return {'keystone_puppet': keystone_puppet,
'keystone_db': keystone_db,
'keystone_db_user': keystone_db_user,
'keystone_service_endpoint': keystone_service_endpoint,
'admin_tenant': admin_tenant,
'admin_user': admin_user,
'admin_role': admin_role,
'services_tenant': services_tenant,
'admin_role_services': admin_role_services,
}
def setup_openrc(node, keystone_puppet, admin_user):
# OPENRC # OPENRC
openrc = vr.create('openrc_file', 'resources/openrc_file', {})[0] openrc = vr.create('openrc_file', 'resources/openrc_file', {})[0]
signals.connect(node1, openrc) node.connect(openrc)
signals.connect(keystone_puppet, openrc, {'ip': 'keystone_host', 'admin_port':'keystone_port'}) keystone_puppet.connect(openrc, {'ip': 'keystone_host', 'admin_port':'keystone_port'})
signals.connect(admin_user, openrc, {'user_name': 'user_name','user_password':'password', 'tenant_name': 'tenant'}) admin_user.connect(openrc, {'user_name': 'user_name','user_password':'password', 'tenant_name': 'tenant'})
return {'openrc_file' : openrc}
def setup_neutron(node, librarian, rabbitmq_service, openstack_rabbitmq_user, openstack_vhost):
# NEUTRON # NEUTRON
# Deploy chain neutron -> (plugins) -> neutron_server -> ( agents ) # Deploy chain neutron -> (plugins) -> neutron_server -> ( agents )
neutron_puppet = vr.create('neutron_puppet', 'resources/neutron_puppet', { neutron_puppet = vr.create('neutron_puppet', 'resources/neutron_puppet', {
'core_plugin': 'neutron.plugins.ml2.plugin.Ml2Plugin' 'core_plugin': 'neutron.plugins.ml2.plugin.Ml2Plugin'
})[0] })[0]
signals.connect(node1, neutron_puppet)
signals.connect(rabbitmq_service1, neutron_puppet, { node.connect(neutron_puppet)
neutron_puppet.connect_with_events(librarian, {'module': 'modules'}, {})
evapi.add_dep(librarian.name, neutron_puppet.name, actions=('run',))
rabbitmq_service.connect(neutron_puppet, {
'ip': 'rabbit_host', 'ip': 'rabbit_host',
'port': 'rabbit_port' 'port': 'rabbit_port'
}) })
signals.connect(openstack_rabbitmq_user, neutron_puppet, { openstack_rabbitmq_user.connect(neutron_puppet, {
'user_name': 'rabbit_user', 'user_name': 'rabbit_user',
'password': 'rabbit_password'}) 'password': 'rabbit_password'})
signals.connect(openstack_vhost, neutron_puppet, { openstack_vhost.connect(neutron_puppet, {
'vhost_name': 'rabbit_virtual_host'}) 'vhost_name': 'rabbit_virtual_host'})
return {'neutron_puppet': neutron_puppet}
def setup_neutron_api(node, mariadb_service, admin_user, keystone_puppet, services_tenant, neutron_puppet):
# NEUTRON PLUGIN AND NEUTRON API (SERVER)
neutron_plugins_ml2 = vr.create('neutron_plugins_ml2', 'resources/neutron_plugins_ml2_puppet', {})[0]
node.connect(neutron_plugins_ml2)
# NEUTRON API (SERVER)
neutron_server_puppet = vr.create('neutron_server_puppet', 'resources/neutron_server_puppet', { neutron_server_puppet = vr.create('neutron_server_puppet', 'resources/neutron_server_puppet', {
'sync_db': True, 'sync_db': True,
})[0] })[0]
evapi.add_dep(neutron_puppet.name, neutron_server_puppet.name, actions=('run',))
evapi.add_dep(neutron_plugins_ml2.name, neutron_server_puppet.name, actions=('run',))
evapi.add_dep(neutron_puppet.name, neutron_plugins_ml2.name, actions=('run',))
neutron_db = vr.create('neutron_db', 'resources/mariadb_db/', { neutron_db = vr.create('neutron_db', 'resources/mariadb_db/', {
'db_name': 'neutron_db', 'login_user': 'root'})[0] 'db_name': 'neutron_db', 'login_user': 'root'})[0]
neutron_db_user = vr.create('neutron_db_user', 'resources/mariadb_user/', { neutron_db_user = vr.create('neutron_db_user', 'resources/mariadb_user/', {
@ -221,6 +269,7 @@ def setup_resources():
neutron_keystone_role = vr.create('neutron_keystone_role', 'resources/keystone_role', { neutron_keystone_role = vr.create('neutron_keystone_role', 'resources/keystone_role', {
'role_name': 'admin' 'role_name': 'admin'
})[0] })[0]
evapi.add_dep(neutron_keystone_role.name, neutron_server_puppet.name, actions=('run',))
neutron_keystone_service_endpoint = vr.create('neutron_keystone_service_endpoint', 'resources/keystone_service_endpoint', { neutron_keystone_service_endpoint = vr.create('neutron_keystone_service_endpoint', 'resources/keystone_service_endpoint', {
'endpoint_name': 'neutron', 'endpoint_name': 'neutron',
'adminurl': 'http://{{admin_ip}}:{{admin_port}}', 'adminurl': 'http://{{admin_ip}}:{{admin_port}}',
@ -230,76 +279,95 @@ def setup_resources():
'type': 'network' 'type': 'network'
})[0] })[0]
signals.connect(node1, neutron_db) node.connect(neutron_db)
signals.connect(node1, neutron_db_user) node.connect(neutron_db_user)
signals.connect(mariadb_service1, neutron_db, { mariadb_service.connect(neutron_db, {
'port': 'login_port', 'port': 'login_port',
'root_password': 'login_password', 'root_password': 'login_password',
'root_user': 'login_user', 'root_user': 'login_user',
'ip' : 'db_host'}) 'ip' : 'db_host'})
signals.connect(mariadb_service1, neutron_db_user, {'port': 'login_port', 'root_password': 'login_password'}) mariadb_service.connect(neutron_db_user, {'port': 'login_port', 'root_password': 'login_password'})
signals.connect(neutron_db, neutron_db_user, {'db_name', 'db_host'}) neutron_db.connect(neutron_db_user, {'db_name', 'db_host'})
signals.connect(neutron_db_user, neutron_server_puppet, { neutron_db_user.connect(neutron_server_puppet, {
'user_name':'db_user', 'user_name':'db_user',
'db_name':'db_name', 'db_name':'db_name',
'user_password':'db_password', 'user_password':'db_password',
'db_host' : 'db_host'}) 'db_host' : 'db_host'})
signals.connect(node1, neutron_server_puppet) node.connect(neutron_server_puppet)
signals.connect(admin_user, neutron_server_puppet, { admin_user.connect(neutron_server_puppet, {
'user_name': 'auth_user', 'user_name': 'auth_user',
'user_password': 'auth_password', 'user_password': 'auth_password',
'tenant_name': 'auth_tenant' 'tenant_name': 'auth_tenant'
}) })
signals.connect(keystone_puppet, neutron_server_puppet, { keystone_puppet.connect(neutron_server_puppet, {
'ip': 'auth_host', 'ip': 'auth_host',
'port': 'auth_port' 'port': 'auth_port'
}) })
signals.connect(services_tenant, neutron_keystone_user) services_tenant.connect(neutron_keystone_user)
signals.connect(neutron_keystone_user, neutron_keystone_role) neutron_keystone_user.connect(neutron_keystone_role)
signals.connect(keystone_puppet, neutron_keystone_service_endpoint, { keystone_puppet.connect(neutron_keystone_service_endpoint, {
'ip': ['ip', 'keystone_host'], 'ip': ['ip', 'keystone_host'],
'admin_port': 'keystone_admin_port', 'admin_port': 'keystone_admin_port',
'admin_token': 'admin_token', 'admin_token': 'admin_token',
}) })
signals.connect(neutron_puppet, neutron_keystone_service_endpoint, { neutron_puppet.connect(neutron_keystone_service_endpoint, {
'ip': ['admin_ip', 'internal_ip', 'public_ip'], 'ip': ['admin_ip', 'internal_ip', 'public_ip'],
'bind_port': ['admin_port', 'internal_port', 'public_port'], 'bind_port': ['admin_port', 'internal_port', 'public_port'],
}) })
return {'neutron_server_puppet': neutron_server_puppet,
'neutron_plugins_ml2': neutron_plugins_ml2,
'neutron_db': neutron_db,
'neutron_db_user': neutron_db_user,
'neutron_keystone_user': neutron_keystone_user,
'neutron_keystone_role': neutron_keystone_role,
'neutron_keystone_service_endpoint': neutron_keystone_service_endpoint}
def setup_neutron_agent(node, neutron_server_puppet):
# NEUTRON ML2 PLUGIN & ML2-OVS AGENT WITH GRE # NEUTRON ML2 PLUGIN & ML2-OVS AGENT WITH GRE
neutron_plugins_ml2 = vr.create('neutron_plugins_ml2', 'resources/neutron_plugins_ml2_puppet', {})[0]
signals.connect(node1, neutron_plugins_ml2)
neutron_agents_ml2 = vr.create('neutron_agents_ml2', 'resources/neutron_agents_ml2_ovs_puppet', { neutron_agents_ml2 = vr.create('neutron_agents_ml2', 'resources/neutron_agents_ml2_ovs_puppet', {
# TODO(bogdando) these should come from the node network resource # TODO(bogdando) these should come from the node network resource
'enable_tunneling': True, 'enable_tunneling': True,
'tunnel_types': ['gre'], 'tunnel_types': ['gre'],
'local_ip': '10.1.0.13' # should be the IP addr of the br-mesh int. 'local_ip': '10.1.0.13' # should be the IP addr of the br-mesh int.
})[0] })[0]
signals.connect(node1, neutron_agents_ml2) node.connect(neutron_agents_ml2)
evapi.add_dep(neutron_server_puppet.name, neutron_agents_ml2.name, actions=('run',))
# NEUTRON DHCP, L3, metadata agents # NEUTRON DHCP, L3, metadata agents
neutron_agents_dhcp = vr.create('neutron_agents_dhcp', 'resources/neutron_agents_dhcp_puppet', {})[0] neutron_agents_dhcp = vr.create('neutron_agents_dhcp', 'resources/neutron_agents_dhcp_puppet', {})[0]
signals.connect(node1, neutron_agents_dhcp) node.connect(neutron_agents_dhcp)
evapi.add_dep(neutron_server_puppet.name, neutron_agents_dhcp.name, actions=('run',))
neutron_agents_l3 = vr.create('neutron_agents_l3', 'resources/neutron_agents_l3_puppet', { neutron_agents_l3 = vr.create('neutron_agents_l3', 'resources/neutron_agents_l3_puppet', {
# TODO(bogdando) these should come from the node network resource # TODO(bogdando) these should come from the node network resource
'metadata_port': 8775, 'metadata_port': 8775,
'external_network_bridge': 'br-floating', 'external_network_bridge': 'br-floating',
})[0] })[0]
signals.connect(node1, neutron_agents_l3) node.connect(neutron_agents_l3)
evapi.add_dep(neutron_server_puppet.name, neutron_agents_l3.name, actions=('run',))
neutron_agents_metadata = vr.create('neutron_agents_metadata', 'resources/neutron_agents_metadata_puppet', { neutron_agents_metadata = vr.create('neutron_agents_metadata', 'resources/neutron_agents_metadata_puppet', {
'shared_secret': 'secret', 'sh2ared_secret': 'secret',
})[0] })[0]
signals.connect(node1, neutron_agents_metadata) node.connect(neutron_agents_metadata)
signals.connect(neutron_server_puppet, neutron_agents_metadata, { neutron_server_puppet.connect(neutron_agents_metadata, {
'auth_host', 'auth_port', 'auth_password', 'auth_host', 'auth_port', 'auth_password',
'auth_tenant', 'auth_user', 'auth_tenant', 'auth_user',
}) })
return {'neutron_agents_ml2': neutron_agents_ml2,
'neutron_agents_dhcp': neutron_agents_dhcp,
'neutron_agents_metadata': neutron_agents_metadata}
def setup_neutron_compute(node, librarian, neutron_puppet, neutron_server_puppet):
# NEUTRON FOR COMPUTE (node2) # NEUTRON FOR COMPUTE (node2)
# Deploy chain neutron -> (plugins) -> ( agents ) # Deploy chain neutron -> (plugins) -> ( agents )
neutron_puppet2 = vr.create('neutron_puppet2', 'resources/neutron_puppet', {})[0] neutron_puppet2 = vr.create('neutron_puppet2', 'resources/neutron_puppet', {})[0]
signals.connect(node2, neutron_puppet2)
signals.connect(neutron_puppet, neutron_puppet2, { neutron_puppet2.connect_with_events(librarian, {'module': 'modules'}, {})
evapi.add_dep(librarian.name, neutron_puppet2.name, actions=('run',))
node.connect(neutron_puppet2)
neutron_puppet.connect(neutron_puppet2, {
'rabbit_host', 'rabbit_port', 'rabbit_host', 'rabbit_port',
'rabbit_user', 'rabbit_password', 'rabbit_user', 'rabbit_password',
'rabbit_virtual_host', 'rabbit_virtual_host',
@ -308,15 +376,25 @@ def setup_resources():
# NEUTRON OVS PLUGIN & AGENT WITH GRE FOR COMPUTE (node2) # NEUTRON OVS PLUGIN & AGENT WITH GRE FOR COMPUTE (node2)
neutron_plugins_ml22 = vr.create('neutron_plugins_ml22', 'resources/neutron_plugins_ml2_puppet', {})[0] neutron_plugins_ml22 = vr.create('neutron_plugins_ml22', 'resources/neutron_plugins_ml2_puppet', {})[0]
signals.connect(node2, neutron_plugins_ml22) node.connect(neutron_plugins_ml22)
evapi.add_dep(neutron_puppet2.name, neutron_plugins_ml22.name, actions=('run',))
evapi.add_dep(neutron_server_puppet.name, neutron_plugins_ml22.name, actions=('run',))
neutron_agents_ml22 = vr.create('neutron_agents_ml22', 'resources/neutron_agents_ml2_ovs_puppet', { neutron_agents_ml22 = vr.create('neutron_agents_ml22', 'resources/neutron_agents_ml2_ovs_puppet', {
# TODO(bogdando) these should come from the node network resource # TODO(bogdando) these should come from the node network resource
'enable_tunneling': True, 'enable_tunneling': True,
'tunnel_types': ['gre'], 'tunnel_types': ['gre'],
'local_ip': '10.1.0.14' # Should be the IP addr of the br-mesh int. 'local_ip': '10.1.0.14' # Should be the IP addr of the br-mesh int.
})[0] })[0]
signals.connect(node2, neutron_agents_ml22) node.connect(neutron_agents_ml22)
evapi.add_dep(neutron_puppet2.name, neutron_agents_ml22.name, actions=('run',))
evapi.add_dep(neutron_server_puppet.name, neutron_agents_ml22.name, actions=('run',))
return {'neutron_puppet2': neutron_puppet2,
'neutron_plugins_ml22': neutron_plugins_ml22,
'neutron_agents_ml22': neutron_agents_ml22}
def setup_cinder(node, librarian, rabbitmq_service, mariadb_service, keystone_puppet, admin_user, openstack_vhost, openstack_rabbitmq_user, services_tenant):
# CINDER # CINDER
cinder_puppet = vr.create('cinder_puppet', 'resources/cinder_puppet', {})[0] cinder_puppet = vr.create('cinder_puppet', 'resources/cinder_puppet', {})[0]
cinder_db = vr.create('cinder_db', 'resources/mariadb_db/', { cinder_db = vr.create('cinder_db', 'resources/mariadb_db/', {
@ -336,61 +414,79 @@ def setup_resources():
'publicurl': 'http://{{public_ip}}:{{public_port}}/v2/%(tenant_id)s', 'publicurl': 'http://{{public_ip}}:{{public_port}}/v2/%(tenant_id)s',
'description': 'OpenStack Block Storage Service', 'type': 'volumev2'})[0] 'description': 'OpenStack Block Storage Service', 'type': 'volumev2'})[0]
signals.connect(node1, cinder_puppet) node.connect(cinder_puppet)
signals.connect(node1, cinder_db) cinder_puppet.connect_with_events(librarian, {'module': 'modules'}, {})
signals.connect(node1, cinder_db_user) evapi.add_dep(librarian.name, cinder_puppet.name, actions=('run',))
signals.connect(rabbitmq_service1, cinder_puppet, {'ip': 'rabbit_host', 'port': 'rabbit_port'})
signals.connect(admin_user, cinder_puppet, {'user_name': 'keystone_user', 'user_password': 'keystone_password', 'tenant_name': 'keystone_tenant'}) #? node.connect(cinder_db)
signals.connect(openstack_vhost, cinder_puppet, {'vhost_name': 'rabbit_virtual_host'}) node.connect(cinder_db_user)
signals.connect(openstack_rabbitmq_user, cinder_puppet, {'user_name': 'rabbit_userid', 'password': 'rabbit_password'}) rabbitmq_service.connect(cinder_puppet, {'ip': 'rabbit_host', 'port': 'rabbit_port'})
signals.connect(mariadb_service1, cinder_db, { admin_user.connect(cinder_puppet, {'user_name': 'keystone_user', 'user_password': 'keystone_password', 'tenant_name': 'keystone_tenant'}) #?
openstack_vhost.connect(cinder_puppet, {'vhost_name': 'rabbit_virtual_host'})
openstack_rabbitmq_user.connect(cinder_puppet, {'user_name': 'rabbit_userid', 'password': 'rabbit_password'})
mariadb_service.connect(cinder_db, {
'port': 'login_port', 'port': 'login_port',
'root_password': 'login_password', 'root_password': 'login_password',
'root_user': 'login_user', 'root_user': 'login_user',
'ip' : 'db_host'}) 'ip' : 'db_host'})
signals.connect(mariadb_service1, cinder_db_user, {'port': 'login_port', 'root_password': 'login_password'}) mariadb_service.connect(cinder_db_user, {'port': 'login_port', 'root_password': 'login_password'})
signals.connect(cinder_db, cinder_db_user, {'db_name', 'db_host'}) cinder_db.connect(cinder_db_user, {'db_name', 'db_host'})
signals.connect(cinder_db_user, cinder_puppet, { cinder_db_user.connect(cinder_puppet, {
'user_name':'db_user', 'user_name':'db_user',
'db_name':'db_name', 'db_name':'db_name',
'user_password':'db_password', 'user_password':'db_password',
'db_host' : 'db_host'}) 'db_host' : 'db_host'})
signals.connect(keystone_puppet, cinder_puppet, {'ip': 'keystone_host', 'admin_port': 'keystone_port'}) #or non admin port? keystone_puppet.connect(cinder_puppet, {'ip': 'keystone_host', 'admin_port': 'keystone_port'}) #or non admin port?
signals.connect(services_tenant, cinder_keystone_user) services_tenant.connect(cinder_keystone_user)
signals.connect(cinder_keystone_user, cinder_keystone_role) cinder_keystone_user.connect(cinder_keystone_role)
signals.connect(cinder_keystone_user, cinder_puppet, {'user_name': 'keystone_user', 'tenant_name': 'keystone_tenant', 'user_password': 'keystone_password'}) cinder_keystone_user.connect(cinder_puppet, {'user_name': 'keystone_user', 'tenant_name': 'keystone_tenant', 'user_password': 'keystone_password'})
signals.connect(mariadb_service1, cinder_puppet, {'ip':'ip'}) mariadb_service.connect(cinder_puppet, {'ip':'ip'})
signals.connect(cinder_puppet, cinder_keystone_service_endpoint, { cinder_puppet.connect(cinder_keystone_service_endpoint, {
'ip': ['ip', 'keystone_host', 'admin_ip', 'internal_ip', 'public_ip'], 'ip': ['ip', 'keystone_host', 'admin_ip', 'internal_ip', 'public_ip'],
'port': ['admin_port', 'internal_port', 'public_port'],}) 'port': ['admin_port', 'internal_port', 'public_port'],})
signals.connect(keystone_puppet, cinder_keystone_service_endpoint, { keystone_puppet.connect(cinder_keystone_service_endpoint, {
'admin_port': 'keystone_admin_port', 'admin_token': 'admin_token'}) 'admin_port': 'keystone_admin_port', 'admin_token': 'admin_token'})
# CINDER GLANCE # CINDER GLANCE
# Deploy chain: cinder_puppet -> cinder_glance -> ( cinder_api, cinder_scheduler, cinder_volume ) # Deploy chain: cinder_puppet -> cinder_glance -> ( cinder_api, cinder_scheduler, cinder_volume )
cinder_glance_puppet = vr.create('cinder_glance_puppet', 'resources/cinder_glance_puppet', {})[0] cinder_glance_puppet = vr.create('cinder_glance_puppet', 'resources/cinder_glance_puppet', {})[0]
signals.connect(node1, cinder_glance_puppet) node.connect(cinder_glance_puppet)
evapi.add_dep(cinder_puppet.name, cinder_glance_puppet.name, actions=('run',))
return {'cinder_puppet': cinder_puppet,
'cinder_db': cinder_db,
'cinder_db_user': cinder_db_user,
'cinder_keystone_user': cinder_keystone_user,
'cinder_keystone_role': cinder_keystone_role,
'cinder_keystone_service_endpoint': cinder_keystone_service_endpoint,
'cinder_glance_puppet': cinder_glance_puppet}
def setup_cinder_api(node, cinder_puppet):
# CINDER API # CINDER API
cinder_api_puppet = vr.create('cinder_api_puppet', 'resources/cinder_api_puppet', {})[0] cinder_api_puppet = vr.create('cinder_api_puppet', 'resources/cinder_api_puppet', {})[0]
signals.connect(node1, cinder_api_puppet) node.connect(cinder_api_puppet)
signals.connect(cinder_puppet, cinder_api_puppet, { cinder_puppet.connect(cinder_api_puppet, {
'keystone_password', 'keystone_tenant', 'keystone_user'}) 'keystone_password', 'keystone_tenant', 'keystone_user'})
signals.connect(cinder_puppet, cinder_api_puppet, { cinder_puppet.connect(cinder_api_puppet, {
'keystone_host': 'keystone_auth_host', 'keystone_host': 'keystone_auth_host',
'keystone_port': 'keystone_auth_port'}) 'keystone_port': 'keystone_auth_port'})
evapi.add_react(cinder_puppet.name, cinder_api_puppet.name, actions=('update',)) return {'cinder_api_puppet': cinder_api_puppet}
def setup_cinder_scheduler(node, cinder_puppet):
# CINDER SCHEDULER # CINDER SCHEDULER
cinder_scheduler_puppet = vr.create('cinder_scheduler_puppet', 'resources/cinder_scheduler_puppet', {})[0] cinder_scheduler_puppet = vr.create('cinder_scheduler_puppet', 'resources/cinder_scheduler_puppet', {})[0]
signals.connect(node1, cinder_scheduler_puppet) node.connect(cinder_scheduler_puppet)
signals.connect(cinder_puppet, cinder_scheduler_puppet) cinder_puppet.connect(cinder_scheduler_puppet)
evapi.add_react(cinder_puppet.name, cinder_scheduler_puppet.name, actions=('update',)) return {'cinder_scheduler_puppet': cinder_scheduler_puppet}
def setup_cinder_volume(node, cinder_puppet):
# CINDER VOLUME # CINDER VOLUME
cinder_volume_puppet = vr.create('cinder_volume_puppet', 'resources/cinder_volume_puppet', {})[0] cinder_volume_puppet = vr.create('cinder_volume_puppet', 'resources/cinder_volume_puppet', {})[0]
signals.connect(node1, cinder_volume_puppet) node.connect(cinder_volume_puppet)
signals.connect(cinder_puppet, cinder_volume_puppet) cinder_puppet.connect(cinder_volume_puppet)
evapi.add_react(cinder_puppet.name, cinder_volume_puppet.name, actions=('update',)) return {'cinder_volume_puppet': cinder_volume_puppet}
def setup_nova(node, librarian, mariadb_service, rabbitmq_service, admin_user, openstack_vhost, services_tenant, keystone_puppet, openstack_rabbitmq_user):
# NOVA # NOVA
nova_puppet = vr.create('nova_puppet', 'resources/nova_puppet', {})[0] nova_puppet = vr.create('nova_puppet', 'resources/nova_puppet', {})[0]
nova_db = vr.create('nova_db', 'resources/mariadb_db/', { nova_db = vr.create('nova_db', 'resources/mariadb_db/', {
@ -413,74 +509,93 @@ def setup_resources():
'description': 'OpenStack Compute Service', 'description': 'OpenStack Compute Service',
'type': 'compute'})[0] 'type': 'compute'})[0]
signals.connect(node1, nova_puppet) node.connect(nova_puppet)
signals.connect(node1, nova_db) nova_puppet.connect_with_events(librarian, {'module': 'modules'}, {})
signals.connect(node1, nova_db_user) evapi.add_dep(librarian.name, nova_puppet.name, actions=('run',))
signals.connect(mariadb_service1, nova_db, {
node.connect(nova_db)
node.connect(nova_db_user)
mariadb_service.connect(nova_db, {
'port': 'login_port', 'port': 'login_port',
'root_password': 'login_password', 'root_password': 'login_password',
'root_user': 'login_user', 'root_user': 'login_user',
'ip' : 'db_host'}) 'ip' : 'db_host'})
signals.connect(mariadb_service1, nova_db_user, { mariadb_service.connect(nova_db_user, {
'port': 'login_port', 'port': 'login_port',
'root_password': 'login_password'}) 'root_password': 'login_password'})
signals.connect(admin_user, nova_puppet, {'user_name': 'keystone_user', 'user_password': 'keystone_password', 'tenant_name': 'keystone_tenant'}) #? admin_user.connect(nova_puppet, {'user_name': 'keystone_user', 'user_password': 'keystone_password', 'tenant_name': 'keystone_tenant'}) #?
signals.connect(openstack_vhost, nova_puppet, {'vhost_name': 'rabbit_virtual_host'}) openstack_vhost.connect(nova_puppet, {'vhost_name': 'rabbit_virtual_host'})
signals.connect(nova_db, nova_db_user, {'db_name', 'db_host'}) nova_db.connect(nova_db_user, {'db_name', 'db_host'})
signals.connect(services_tenant, nova_keystone_user) services_tenant.connect(nova_keystone_user)
signals.connect(nova_keystone_user, nova_keystone_role) nova_keystone_user.connect(nova_keystone_role)
signals.connect(keystone_puppet, nova_puppet, { keystone_puppet.connect(nova_puppet, {
'ip': 'keystone_host', 'ip': 'keystone_host',
'admin_port': 'keystone_port'}) 'admin_port': 'keystone_port'})
signals.connect(nova_keystone_user, nova_puppet, { nova_keystone_user.connect(nova_puppet, {
'user_name': 'keystone_user', 'user_name': 'keystone_user',
'tenant_name': 'keystone_tenant', 'tenant_name': 'keystone_tenant',
'user_password': 'keystone_password'}) 'user_password': 'keystone_password'})
signals.connect(rabbitmq_service1, nova_puppet, { rabbitmq_service.connect(nova_puppet, {
'ip': 'rabbit_host', 'port': 'rabbit_port'}) 'ip': 'rabbit_host', 'port': 'rabbit_port'})
signals.connect(openstack_rabbitmq_user, nova_puppet, { openstack_rabbitmq_user.connect(nova_puppet, {
'user_name': 'rabbit_userid', 'user_name': 'rabbit_userid',
'password': 'rabbit_password'}) 'password': 'rabbit_password'})
signals.connect(keystone_puppet, nova_keystone_service_endpoint, { keystone_puppet.connect(nova_keystone_service_endpoint, {
'ip': 'keystone_host', 'ip': 'keystone_host',
'admin_port': 'keystone_admin_port', 'admin_port': 'keystone_admin_port',
'admin_token': 'admin_token'}) 'admin_token': 'admin_token'})
signals.connect(mariadb_service1, nova_puppet, { mariadb_service.connect(nova_puppet, {
'ip':'db_host'}) 'ip':'db_host'})
signals.connect(nova_db_user, nova_puppet, { nova_db_user.connect(nova_puppet, {
'user_name':'db_user', 'user_name':'db_user',
'db_name':'db_name', 'db_name':'db_name',
'user_password':'db_password', 'user_password':'db_password',
'db_host' : 'db_host'}) 'db_host' : 'db_host'})
signals.connect(nova_puppet, nova_keystone_service_endpoint, { nova_puppet.connect(nova_keystone_service_endpoint, {
'ip': ['ip', 'keystone_host', 'public_ip', 'internal_ip', 'admin_ip'], 'ip': ['ip', 'keystone_host', 'public_ip', 'internal_ip', 'admin_ip'],
'port': ['admin_port', 'internal_port', 'public_port'], 'port': ['admin_port', 'internal_port', 'public_port'],
}) })
return {'nova_puppet': nova_puppet,
'nova_db': nova_db,
'nova_db_user': nova_db_user,
'nova_keystone_user': nova_keystone_user,
'nova_keystone_role': nova_keystone_role,
'nova_keystone_service_endpoint': nova_keystone_service_endpoint}
def setup_nova_api(node, nova_puppet, neutron_agents_metadata):
# NOVA API # NOVA API
nova_api_puppet = vr.create('nova_api_puppet', 'resources/nova_api_puppet', {})[0] nova_api_puppet = vr.create('nova_api_puppet', 'resources/nova_api_puppet', {})[0]
signals.connect(node1, nova_api_puppet) node.connect(nova_api_puppet)
signals.connect(nova_puppet, nova_api_puppet, { nova_puppet.connect(nova_api_puppet, {
'keystone_tenant': 'admin_tenant_name', 'keystone_tenant': 'admin_tenant_name',
'keystone_user': 'admin_user', 'keystone_user': 'admin_user',
'keystone_password': 'admin_password', 'keystone_password': 'admin_password',
'keystone_host': 'auth_host', 'keystone_host': 'auth_host',
'keystone_port': 'auth_port'}) 'keystone_port': 'auth_port'})
signals.connect(nova_api_puppet, neutron_agents_metadata, {'ip': 'metadata_ip'}) nova_api_puppet.connect(neutron_agents_metadata, {'ip': 'metadata_ip'})
return {'nova_api_puppet': nova_api_puppet}
def setup_nova_conductor(node, nova_puppet, nova_api_puppet):
# NOVA CONDUCTOR # NOVA CONDUCTOR
nova_conductor_puppet = vr.create('nova_conductor_puppet', 'resources/nova_conductor_puppet', {})[0] nova_conductor_puppet = vr.create('nova_conductor_puppet', 'resources/nova_conductor_puppet', {})[0]
signals.connect(node1, nova_conductor_puppet) node.connect(nova_conductor_puppet)
signals.connect(nova_puppet, nova_conductor_puppet) nova_puppet.connect(nova_conductor_puppet)
evapi.add_dep(nova_api_puppet.name, nova_conductor_puppet.name, actions=('run',))
return {'nova_conductor': nova_conductor_puppet}
def setup_nova_scheduler(node, nova_puppet, nova_api_puppet):
# NOVA SCHEDULER # NOVA SCHEDULER
# NOTE(bogdando) Generic service is used. Package and service names for Ubuntu case # NOTE(bogdando) Generic service is used. Package and service names for Ubuntu case
# come from https://github.com/openstack/puppet-nova/blob/5.1.0/manifests/params.pp # come from https://github.com/openstack/puppet-nova/blob/5.1.0/manifests/params.pp
nova_scheduler_puppet = vr.create('nova_scheduler_puppet', 'resources/nova_generic_service_puppet', { nova_scheduler_puppet = vr.create('nova_scheduler_puppet', 'resources/nova_generic_service_puppet', {
'title' : 'scheduler', 'package_name': 'nova-scheduler', 'service_name': 'nova-scheduler', 'title' : 'scheduler', 'package_name': 'nova-scheduler', 'service_name': 'nova-scheduler',
})[0] })[0]
signals.connect(node1, nova_scheduler_puppet) node.connect(nova_scheduler_puppet)
evapi.add_dep(nova_puppet.name, nova_scheduler_puppet.name, actions=('run',))
evapi.add_dep(nova_api_puppet.name, nova_scheduler_puppet.name, actions=('run',))
return {'nova_scheduler_puppet': nova_scheduler_puppet}
def setup_nova_compute(node, librarian, nova_puppet, nova_api_puppet, neutron_server_puppet, neutron_keystone_service_endpoint):
# NOVA COMPUTE # NOVA COMPUTE
# Deploy chain (nova, node_networking(TODO)) -> (nova_compute_libvirt, nova_neutron) -> nova_compute # Deploy chain (nova, node_networking(TODO)) -> (nova_compute_libvirt, nova_neutron) -> nova_compute
nova_compute_puppet = vr.create('nova_compute_puppet', 'resources/nova_compute_puppet', {})[0] nova_compute_puppet = vr.create('nova_compute_puppet', 'resources/nova_compute_puppet', {})[0]
@ -488,7 +603,7 @@ def setup_resources():
nova_puppet2 = vr.create('nova_puppet2', 'resources/nova_puppet', { nova_puppet2 = vr.create('nova_puppet2', 'resources/nova_puppet', {
'glance_api_servers': '{{glance_api_servers_host}}:{{glance_api_servers_port}}' 'glance_api_servers': '{{glance_api_servers_host}}:{{glance_api_servers_port}}'
})[0] })[0]
signals.connect(nova_puppet, nova_puppet2, { nova_puppet.connect(nova_puppet2, {
'ensure_package', 'rabbit_host', 'ensure_package', 'rabbit_host',
'rabbit_password', 'rabbit_port', 'rabbit_userid', 'rabbit_password', 'rabbit_port', 'rabbit_userid',
'rabbit_virtual_host', 'db_user', 'db_password', 'rabbit_virtual_host', 'db_user', 'db_password',
@ -497,24 +612,34 @@ def setup_resources():
'keystone_user', 'keystone_user',
}) })
# TODO(bogdando): Make a connection for nova_puppet2.glance_api_servers = "glance_api_puppet.ip:glance_api_puppet.bind_port" # TODO(bogdando): Make a connection for nova_puppet2.glance_api_servers = "glance_api_puppet.ip:glance_api_puppet.bind_port"
signals.connect(node2, nova_puppet2) node.connect(nova_puppet2)
signals.connect(node2, nova_compute_puppet) nova_puppet2.connect_with_events(librarian, {'module': 'modules'}, {})
evapi.add_dep(librarian.name, nova_puppet2.name, actions=('run',))
node.connect(nova_compute_puppet)
evapi.add_dep(nova_puppet2.name, nova_compute_puppet.name, actions=('run',))
evapi.add_dep(nova_api_puppet.name, nova_compute_puppet.name, actions=('run',))
# NOVA COMPUTE LIBVIRT, NOVA_NEUTRON # NOVA COMPUTE LIBVIRT, NOVA_NEUTRON
# NOTE(bogdando): changes nova config, so should notify nova compute service # NOTE(bogdando): changes nova config, so should notify nova compute service
nova_compute_libvirt_puppet = vr.create('nova_compute_libvirt_puppet', 'resources/nova_compute_libvirt_puppet', {})[0] nova_compute_libvirt_puppet = vr.create('nova_compute_libvirt_puppet', 'resources/nova_compute_libvirt_puppet', {})[0]
signals.connect(node2, nova_compute_libvirt_puppet) node.connect(nova_compute_libvirt_puppet)
evapi.add_dep(nova_puppet2.name, nova_compute_libvirt_puppet.name, actions=('run',))
evapi.add_dep(nova_api_puppet.name, nova_compute_libvirt_puppet.name, actions=('run',))
# compute configuration for neutron, use http auth/endpoint protocols, keystone v2 auth hardcoded for the resource # compute configuration for neutron, use http auth/endpoint protocols, keystone v2 auth hardcoded for the resource
nova_neutron_puppet = vr.create('nova_neutron_puppet', 'resources/nova_neutron_puppet', {})[0] nova_neutron_puppet = vr.create('nova_neutron_puppet', 'resources/nova_neutron_puppet', {})[0]
signals.connect(node2, nova_neutron_puppet) node.connect(nova_neutron_puppet)
signals.connect(neutron_server_puppet, nova_neutron_puppet, { evapi.add_dep(nova_puppet2.name, nova_neutron_puppet.name, actions=('run',))
evapi.add_dep(nova_api_puppet.name, nova_neutron_puppet.name, actions=('run',))
neutron_server_puppet.connect(nova_neutron_puppet, {
'auth_password': 'neutron_admin_password', 'auth_password': 'neutron_admin_password',
'auth_user': 'neutron_admin_username', 'auth_user': 'neutron_admin_username',
'auth_type': 'neutron_auth_strategy', 'auth_type': 'neutron_auth_strategy',
'auth_host': 'auth_host', 'auth_port': 'auth_port', 'auth_host': 'auth_host', 'auth_port': 'auth_port',
'auth_protocol': 'auth_protocol', 'auth_protocol': 'auth_protocol',
}) })
signals.connect(neutron_keystone_service_endpoint, nova_neutron_puppet, { neutron_keystone_service_endpoint.connect(nova_neutron_puppet, {
'internal_ip':'neutron_endpoint_host', 'internal_ip':'neutron_endpoint_host',
'internal_port':'neutron_endpoint_port', 'internal_port':'neutron_endpoint_port',
}) })
@ -522,7 +647,13 @@ def setup_resources():
# signals.connect(keystone_puppet, nova_network_puppet, {'ip': 'keystone_host', 'port': 'keystone_port'}) # signals.connect(keystone_puppet, nova_network_puppet, {'ip': 'keystone_host', 'port': 'keystone_port'})
# signals.connect(keystone_puppet, nova_keystone_service_endpoint, {'ip': 'keystone_host', 'admin_port': 'keystone_port', 'admin_token': 'admin_token'}) # signals.connect(keystone_puppet, nova_keystone_service_endpoint, {'ip': 'keystone_host', 'admin_port': 'keystone_port', 'admin_token': 'admin_token'})
# signals.connect(rabbitmq_service1, nova_network_puppet, {'ip': 'rabbitmq_host', 'port': 'rabbitmq_port'}) # signals.connect(rabbitmq_service1, nova_network_puppet, {'ip': 'rabbitmq_host', 'port': 'rabbitmq_port'})
return {'nova_compute_puppet': nova_compute_puppet,
'nova_puppet2': nova_puppet2,
'nova_compute_libvirt_puppet': nova_compute_libvirt_puppet,
'nova_neutron_puppet': nova_neutron_puppet,
'neutron_server_puppet': neutron_server_puppet}
def setup_glance_api(node, librarian, mariadb_service, admin_user, keystone_puppet, services_tenant, cinder_glance_puppet, nova_puppet2):
# GLANCE (base and API) # GLANCE (base and API)
glance_api_puppet = vr.create('glance_api_puppet', 'resources/glance_puppet', {})[0] glance_api_puppet = vr.create('glance_api_puppet', 'resources/glance_puppet', {})[0]
glance_db_user = vr.create('glance_db_user', 'resources/mariadb_user/', { glance_db_user = vr.create('glance_db_user', 'resources/mariadb_user/', {
@ -542,41 +673,62 @@ def setup_resources():
'publicurl': 'http://{{public_ip}}:{{public_port}}', 'publicurl': 'http://{{public_ip}}:{{public_port}}',
'description': 'OpenStack Image Service', 'type': 'image'})[0] 'description': 'OpenStack Image Service', 'type': 'image'})[0]
signals.connect(node1, glance_api_puppet) node.connect(glance_api_puppet)
signals.connect(node1, glance_db) glance_api_puppet.connect_with_events(librarian, {'module': 'modules'}, {})
signals.connect(node1, glance_db_user) evapi.add_dep(librarian.name, glance_api_puppet.name, actions=('run',))
signals.connect(admin_user, glance_api_puppet, {
node.connect(glance_db)
node.connect(glance_db_user)
admin_user.connect(glance_api_puppet, {
'user_name': 'keystone_user', 'user_password': 'keystone_password', 'user_name': 'keystone_user', 'user_password': 'keystone_password',
'tenant_name': 'keystone_tenant'}) #? 'tenant_name': 'keystone_tenant'}) #?
signals.connect(mariadb_service1, glance_db, { mariadb_service.connect(glance_db, {
'port': 'login_port', 'port': 'login_port',
'root_password': 'login_password', 'root_password': 'login_password',
'root_user': 'login_user', 'root_user': 'login_user',
'ip' : 'db_host'}) 'ip' : 'db_host'})
signals.connect(mariadb_service1, glance_db_user, {'port': 'login_port', 'root_password': 'login_password'}) mariadb_service.connect(glance_db_user, {'port': 'login_port', 'root_password': 'login_password'})
signals.connect(glance_db, glance_db_user, {'db_name', 'db_host'}) glance_db.connect(glance_db_user, {'db_name', 'db_host'})
signals.connect(glance_db_user, glance_api_puppet, { glance_db_user.connect(glance_api_puppet, {
'user_name':'db_user', 'user_name':'db_user',
'db_name':'db_name', 'db_name':'db_name',
'user_password':'db_password', 'user_password':'db_password',
'db_host' : 'db_host'}) 'db_host' : 'db_host'})
signals.connect(keystone_puppet, glance_api_puppet, {'ip': 'keystone_host', 'admin_port': 'keystone_port'}) #or non admin port? keystone_puppet.connect(glance_api_puppet, {'ip': 'keystone_host', 'admin_port': 'keystone_port'}) #or non admin port?
signals.connect(services_tenant, glance_keystone_user) services_tenant.connect(glance_keystone_user)
signals.connect(glance_keystone_user, glance_keystone_role) glance_keystone_user.connect(glance_keystone_role)
signals.connect(glance_keystone_user, glance_api_puppet, { glance_keystone_user.connect(glance_api_puppet, {
'user_name': 'keystone_user', 'tenant_name': 'keystone_tenant', 'user_name': 'keystone_user', 'tenant_name': 'keystone_tenant',
'user_password': 'keystone_password'}) 'user_password': 'keystone_password'})
signals.connect(mariadb_service1, glance_api_puppet, {'ip':'ip'}) mariadb_service.connect(glance_api_puppet, {'ip':'ip'})
signals.connect(glance_api_puppet, glance_keystone_service_endpoint, { glance_api_puppet.connect(glance_keystone_service_endpoint, {
'ip': ['ip', 'keystone_host', 'admin_ip', 'internal_ip', 'public_ip'], 'ip': ['ip', 'keystone_host', 'admin_ip', 'internal_ip', 'public_ip'],
'bind_port': ['admin_port', 'internal_port', 'public_port'],}) 'bind_port': ['admin_port', 'internal_port', 'public_port'],})
signals.connect(keystone_puppet, glance_keystone_service_endpoint, { keystone_puppet.connect(glance_keystone_service_endpoint, {
'admin_port': 'keystone_admin_port', 'admin_token': 'admin_token'}) 'admin_port': 'keystone_admin_port', 'admin_token': 'admin_token'})
# Update glance_api_service for cinder
glance_api_puppet.connect(cinder_glance_puppet, {
'ip': 'glance_api_servers_host',
'bind_port': 'glance_api_servers_port'
})
# Update glance_api_service for nova compute
glance_api_puppet.connect(nova_puppet2, {
'ip': 'glance_api_servers_host',
'bind_port': 'glance_api_servers_port'
})
return {'glance_api_puppet': glance_api_puppet,
'glance_db_user': glance_db_user,
'glance_db': glance_db,
'glance_keystone_user': glance_keystone_user,
'glance_keystone_role': glance_keystone_role,
'glance_keystone_service_endpoint': glance_keystone_service_endpoint}
def setup_glance_registry(node, glance_api_puppet):
# GLANCE REGISTRY # GLANCE REGISTRY
glance_registry_puppet = vr.create('glance_registry_puppet', 'resources/glance_registry_puppet', {})[0] glance_registry_puppet = vr.create('glance_registry_puppet', 'resources/glance_registry_puppet', {})[0]
signals.connect(node1, glance_registry_puppet) node.connect(glance_registry_puppet)
signals.connect(glance_api_puppet, glance_registry_puppet) glance_api_puppet.connect(glance_registry_puppet)
# API and registry should not listen same ports # API and registry should not listen same ports
# should not use the same log destination and a pipeline, # should not use the same log destination and a pipeline,
# so disconnect them and restore the defaults # so disconnect them and restore the defaults
@ -588,27 +740,10 @@ def setup_resources():
'log_file': '/var/log/glance/registry.log', 'log_file': '/var/log/glance/registry.log',
'pipeline': 'keystone', 'pipeline': 'keystone',
}) })
return {'glance_registry_puppet': glance_registry_puppet}
# Update glance_api_service for cinder
signals.connect(glance_api_puppet, cinder_glance_puppet, {
'ip': 'glance_api_servers_host',
'bind_port': 'glance_api_servers_port'
})
# Update glance_api_service for nova compute
signals.connect(glance_api_puppet, nova_puppet2, {
'ip': 'glance_api_servers_host',
'bind_port': 'glance_api_servers_port'
})
if PROFILE:
pr.disable()
s = StringIO.StringIO()
sortby = 'cumulative'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print s.getvalue()
sys.exit(0)
def validate():
has_errors = False has_errors = False
for r in locals().values(): for r in locals().values():
if not isinstance(r, resource.Resource): if not isinstance(r, resource.Resource):
@ -624,117 +759,49 @@ def setup_resources():
sys.exit(1) sys.exit(1)
resources_to_run = [
'node1_sdn',
'rabbitmq_service1',
'openstack_vhost',
'openstack_rabbitmq_user',
'mariadb_service1',
'keystone_db',
'keystone_db_user',
'keystone_puppet',
'openrc_file',
'admin_tenant',
'admin_user',
'admin_role',
'keystone_service_endpoint',
'services_tenant',
'neutron_db',
'neutron_db_user',
'neutron_keystone_user',
'neutron_keystone_role',
'neutron_puppet',
'neutron_keystone_service_endpoint',
'neutron_plugins_ml2',
'neutron_server_puppet',
'neutron_agents_ml2',
'neutron_agents_dhcp',
'neutron_agents_l3',
'neutron_agents_metadata',
'cinder_db',
'cinder_db_user',
'cinder_keystone_user',
'cinder_keystone_role',
'cinder_puppet',
'cinder_keystone_service_endpoint',
'cinder_glance_puppet',
'cinder_api_puppet',
'cinder_scheduler_puppet',
'cinder_volume_puppet',
'nova_db',
'nova_db_user',
'nova_keystone_user',
'nova_keystone_role',
'nova_puppet',
'nova_keystone_service_endpoint',
'nova_api_puppet',
'nova_conductor_puppet',
'nova_scheduler_puppet',
'node2_sdn',
'glance_db',
'glance_db_user',
'glance_keystone_user',
'glance_keystone_role',
'glance_keystone_service_endpoint',
'glance_api_puppet',
'glance_registry_puppet',
'nova_puppet2',
'nova_compute_libvirt_puppet',
'nova_neutron_puppet',
'nova_compute_puppet',
'neutron_puppet2',
'neutron_plugins_ml22',
'neutron_agents_ml22',
]
@click.command() @click.command()
def deploy(): def deploy():
setup_resources() r= {}
r.update(setup_base())
# run r.update(setup_keystone(r['node1'], r['librarian_node1'],
resources = resource.load_all() r['mariadb_service'], r['openstack_rabbitmq_user']))
resources = {r.name: r for r in resources} r.update(setup_openrc(r['node1'], r['keystone_puppet'], r['admin_user']))
r.update(setup_neutron(r['node1'], r['librarian_node1'], r['rabbitmq_service1'],
for name in resources_to_run: r['openstack_rabbitmq_user'], r['openstack_vhost']))
try: r.update(setup_neutron_api(r['node1'], r['mariadb_service'], r['admin_user'],
actions.resource_action(resources[name], 'run') r['keystone_puppet'], r['services_tenant'], r['neutron_puppet']))
except errors.SolarError as e: r.update(setup_neutron_agent(r['node1'], r['neutron_server_puppet']))
print 'WARNING: %s' % str(e) r.update(setup_neutron_compute(r['node2'], r['librarian_node2'], r['neutron_puppet'], r['neutron_server_puppet']))
raise r.update(setup_cinder(r['node1'], r['librarian_node1'], r['rabbitmq_service1'],
r['mariadb_service'], r['keystone_puppet'], r['admin_user'],
time.sleep(10) r['openstack_vhost'], r['openstack_rabbitmq_user'], r['services_tenant']))
r.update(setup_cinder_api(r['node1'], r['cinder_puppet']))
r.update(setup_cinder_scheduler(r['node1'], r['cinder_puppet']))
@click.command() r.update(setup_cinder_volume(r['node1'], r['cinder_puppet']))
def undeploy(): r.update(setup_nova(r['node1'], r['librarian_node1'], r['mariadb_service'], r['rabbitmq_service1'],
resources = resource.load_all() r['admin_user'], r['openstack_vhost'], r['services_tenant'],
resources = {r.name: r for r in resources} r['keystone_puppet'], r['openstack_rabbitmq_user']))
r.update(setup_nova_api(r['node1'], r['nova_puppet'], r['neutron_agents_metadata']))
for name in reversed(resources_to_run): r.update(setup_nova_conductor(r['node1'], r['nova_puppet'], r['nova_api_puppet']))
try: r.update(setup_nova_scheduler(r['node1'], r['nova_puppet'], r['nova_api_puppet']))
actions.resource_action(resources[name], 'remove') r.update(setup_nova_compute(r['node2'], r['librarian_node2'], r['nova_puppet'], r['nova_api_puppet'],
except errors.SolarError as e: r['neutron_server_puppet'], r['neutron_keystone_service_endpoint']))
print 'WARNING: %s' % str(e) r.update(setup_glance_api(r['node1'], r['librarian_node1'], r['mariadb_service'], r['admin_user'],
r['keystone_puppet'], r['services_tenant'],
db.clear() r['cinder_glance_puppet'], r['nova_puppet2']))
r.update(setup_glance_registry(r['node1'], r['glance_api_puppet']))
print '\n'.join(r.keys())
main.add_command(deploy)
main.add_command(undeploy)
if __name__ == '__main__': if __name__ == '__main__':
main.add_command(deploy)
main() main()
if PROFILE:
pr.disable()
s = StringIO.StringIO()
sortby = 'cumulative'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print s.getvalue()
sys.exit(0)

View File

@ -1,6 +1,5 @@
id: cinder_puppet id: cinder_puppet
handler: puppet handler: puppet
puppet_module: cinder
version: 1.0.0 version: 1.0.0
input: input:
database_connection: database_connection:
@ -174,9 +173,9 @@ input:
schema: int! schema: int!
value: 8776 value: 8776
git: module:
schema: {repository: str!, branch: str!} schema: {name: str!, type: str, url: str, ref: str}
value: {repository: 'https://github.com/openstack/puppet-cinder', branch: '5.1.0'} value: {name: 'cinder', type: 'git', url: 'https://github.com/openstack/puppet-cinder', ref: '5.1.0'}
keystone_host: keystone_host:
schema: str! schema: str!

View File

@ -124,9 +124,9 @@ input:
schema: str schema: str
value: value:
git: module:
schema: {repository: str!, branch: str!} schema: {repository: str!, branch: str!}
value: {repository: 'https://github.com/openstack/puppet-glance', branch: '5.1.0'} value: {name: 'glance', type: 'git', url: 'https://github.com/openstack/puppet-glance', ref: '5.1.0'}
ip: ip:
schema: str! schema: str!

View File

@ -17,7 +17,7 @@ class {'keystone':
database_connection => "mysql://$db_user:$db_password@$db_host/$db_name", database_connection => "mysql://$db_user:$db_password@$db_host/$db_name",
public_port => "$port", public_port => "$port",
admin_port => "$admin_port", admin_port => "$admin_port",
token_driver => 'keystone.token.backends.kvs.Token' token_driver => 'keystone.token.persistence.backends.sql.Token'
} }
#file { '/etc/keystone/keystone-exports': #file { '/etc/keystone/keystone-exports':

View File

@ -1,7 +1,20 @@
$resource = hiera($::resource_name)
$ip = $resource['input']['ip']['value']
$admin_token = $resource['input']['admin_token']['value']
$db_user = $resource['input']['db_user']['value']
$db_host = $resource['input']['db_host']['value']
$db_password = $resource['input']['db_password']['value']
$db_name = $resource['input']['db_name']['value']
$admin_port = $resource['input']['admin_port']['value']
$port = $resource['input']['port']['value']
class {'keystone': class {'keystone':
verbose => true, package_ensure => 'present',
catalog_type => 'sql', verbose => true,
admin_token => '{{ admin_token }}', catalog_type => 'sql',
sql_connection => 'mysql://{{ db_user }}:{{ db_password }}@{{ ip }}/{{ db_name }}', admin_token => $admin_token,
public_port => '{{ port }}' database_connection => "mysql://$db_user:$db_password@$db_host/$db_name",
public_port => "$port",
admin_port => "$admin_port",
} }

View File

@ -26,13 +26,9 @@ input:
schema: int! schema: int!
value: 5000 value: 5000
git: module:
schema: {repository: str!, branch: str!} schema: {name: str!, type: str, url: str, ref: str}
value: {repository: 'https://github.com/openstack/puppet-keystone', branch: '5.1.0'} value: {name: 'keystone', type: 'git', url: 'https://github.com/openstack/puppet-keystone', ref: '5.1.0'}
# forge:
# schema: str!
# value: 'stackforge-keystone'
ip: ip:
schema: str! schema: str!

View File

@ -180,9 +180,9 @@ input:
schema: str schema: str
value: '/var/log/neutron' value: '/var/log/neutron'
git: module:
schema: {repository: str!, branch: str!} schema: {name: str!, type: str, url: str, ref: str}
value: {repository: 'https://github.com/openstack/puppet-neutron', branch: '5.1.0'} value: {name: neutron, type: 'git', url: 'https://github.com/openstack/puppet-neutron', ref: '5.1.0'}
puppet_module: 'neutron' puppet_module: 'neutron'
tags: [resource/neutron] tags: [resource/neutron]

View File

@ -49,9 +49,9 @@ input:
roles: {}, roles: {},
} }
git: module:
schema: {repository: str!, branch: str!} schema: {repository: str!, branch: str!}
value: {repository: 'https://github.com/xenolog/l23network', branch: '50098cfa1f0f8e8d58e6a6b77a22f1380aa5c426'} value: {name: 'l23network', type: 'git', url: 'https://github.com/xenolog/l23network', ref: '50098cfa1f0f8e8d58e6a6b77a22f1380aa5c426'}
ip: ip:
schema: str! schema: str!

View File

@ -233,9 +233,9 @@ input:
schema: int! schema: int!
value: 8774 value: 8774
git: module:
schema: {repository: str!, branch: str!} schema: {repository: str!, branch: str!}
value: {repository: 'https://github.com/openstack/puppet-nova', branch: '5.1.0'} value: {name: 'nova', type: 'git', url: 'https://github.com/openstack/puppet-nova', ref: '5.1.0'}
ip: ip:
schema: str! schema: str!

View File

@ -17,10 +17,9 @@ input:
management_port: management_port:
schema: int! schema: int!
value: 15672 value: 15672
git: module:
schema: {repository: str!, branch: str!} schema: {name: str!, type: str, url: str, ref: str}
value: {repository: 'https://github.com/puppetlabs/puppetlabs-rabbitmq.git', branch: '5.1.0'} value: {name: 'rabbitmq', type: 'git', url: 'https://github.com/puppetlabs/puppetlabs-rabbitmq.git', ref: '5.1.0'}
puppet_module: 'rabbitmq'
tags: [] tags: []
version: 1.0.0 version: 1.0.0