Do not use hardcoded db port
This commit is contained in:
parent
a532cf6b41
commit
4eb19f8080
@ -201,7 +201,10 @@ def setup_keystone(node, librarian, mariadb_service, openstack_rabbitmq_user):
|
||||
keystone_db_user.connect(keystone_puppet, {
|
||||
'user_name': 'db_user',
|
||||
'user_password': 'db_password',
|
||||
'db_host' : 'db_host'
|
||||
})
|
||||
mariadb_service.connect(keystone_puppet, {
|
||||
'ip': 'db_host',
|
||||
'port': 'db_port',
|
||||
})
|
||||
return {'keystone_puppet': keystone_puppet,
|
||||
'keystone_db': keystone_db,
|
||||
@ -293,6 +296,9 @@ def setup_neutron_api(node, mariadb_service, admin_user, keystone_puppet, servic
|
||||
'db_name':'db_name',
|
||||
'user_password':'db_password',
|
||||
'db_host' : 'db_host'})
|
||||
mariadb_service.connect(neutron_server_puppet, {
|
||||
'port': 'db_port',
|
||||
'ip' : 'db_host'})
|
||||
node.connect(neutron_server_puppet)
|
||||
admin_user.connect(neutron_server_puppet, {
|
||||
'user_name': 'auth_user',
|
||||
@ -434,8 +440,10 @@ def setup_cinder(node, librarian, rabbitmq_service, mariadb_service, keystone_pu
|
||||
cinder_db_user.connect(cinder_puppet, {
|
||||
'user_name':'db_user',
|
||||
'db_name':'db_name',
|
||||
'user_password':'db_password',
|
||||
'db_host' : 'db_host'})
|
||||
'user_password':'db_password'})
|
||||
mariadb_service.connect(cinder_puppet, {
|
||||
'port': 'db_port',
|
||||
'ip': 'db_host'})
|
||||
keystone_puppet.connect(cinder_puppet, {'ip': 'keystone_host', 'admin_port': 'keystone_port'}) #or non admin port?
|
||||
services_tenant.connect(cinder_keystone_user)
|
||||
cinder_keystone_user.connect(cinder_keystone_role)
|
||||
@ -470,6 +478,7 @@ def setup_cinder_api(node, cinder_puppet):
|
||||
cinder_puppet.connect(cinder_api_puppet, {
|
||||
'keystone_host': 'keystone_auth_host',
|
||||
'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):
|
||||
@ -477,6 +486,7 @@ def setup_cinder_scheduler(node, cinder_puppet):
|
||||
cinder_scheduler_puppet = vr.create('cinder_scheduler_puppet', 'resources/cinder_scheduler_puppet', {})[0]
|
||||
node.connect(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):
|
||||
@ -484,6 +494,7 @@ def setup_cinder_volume(node, cinder_puppet):
|
||||
cinder_volume_puppet = vr.create('cinder_volume_puppet', 'resources/cinder_volume_puppet', {})[0]
|
||||
node.connect(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):
|
||||
@ -545,12 +556,12 @@ def setup_nova(node, librarian, mariadb_service, rabbitmq_service, admin_user, o
|
||||
'admin_port': 'keystone_admin_port',
|
||||
'admin_token': 'admin_token'})
|
||||
mariadb_service.connect(nova_puppet, {
|
||||
'ip':'db_host'})
|
||||
'ip':'db_host',
|
||||
'port': 'db_port'})
|
||||
nova_db_user.connect(nova_puppet, {
|
||||
'user_name':'db_user',
|
||||
'db_name':'db_name',
|
||||
'user_password':'db_password',
|
||||
'db_host' : 'db_host'})
|
||||
'user_password':'db_password'})
|
||||
nova_puppet.connect(nova_keystone_service_endpoint, {
|
||||
'ip': ['ip', 'keystone_host', 'public_ip', 'internal_ip', 'admin_ip'],
|
||||
'port': ['admin_port', 'internal_port', 'public_port'],
|
||||
@ -572,6 +583,7 @@ def setup_nova_api(node, nova_puppet, neutron_agents_metadata):
|
||||
'keystone_password': 'admin_password',
|
||||
'keystone_host': 'auth_host',
|
||||
'keystone_port': 'auth_port'})
|
||||
evapi.add_react(nova_puppet.name, nova_api_puppet.name, actions=('update',))
|
||||
nova_api_puppet.connect(neutron_agents_metadata, {'ip': 'metadata_ip'})
|
||||
return {'nova_api_puppet': nova_api_puppet}
|
||||
|
||||
@ -581,6 +593,7 @@ def setup_nova_conductor(node, nova_puppet, nova_api_puppet):
|
||||
node.connect(nova_conductor_puppet)
|
||||
nova_puppet.connect(nova_conductor_puppet)
|
||||
evapi.add_dep(nova_api_puppet.name, nova_conductor_puppet.name, actions=('run',))
|
||||
evapi.add_react(nova_puppet.name, nova_conductor_puppet.name, actions=('update',))
|
||||
return {'nova_conductor': nova_conductor_puppet}
|
||||
|
||||
def setup_nova_scheduler(node, nova_puppet, nova_api_puppet):
|
||||
@ -593,6 +606,7 @@ def setup_nova_scheduler(node, nova_puppet, nova_api_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',))
|
||||
evapi.add_react(nova_puppet.name, nova_scheduler_puppet.name, actions=('update',))
|
||||
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):
|
||||
@ -694,6 +708,9 @@ def setup_glance_api(node, librarian, mariadb_service, admin_user, keystone_pupp
|
||||
'db_name':'db_name',
|
||||
'user_password':'db_password',
|
||||
'db_host' : 'db_host'})
|
||||
mariadb_service.connect(glance_api_puppet,{
|
||||
'port': 'db_port',
|
||||
'ip': 'db_host'})
|
||||
keystone_puppet.connect(glance_api_puppet, {'ip': 'keystone_host', 'admin_port': 'keystone_port'}) #or non admin port?
|
||||
services_tenant.connect(glance_keystone_user)
|
||||
glance_keystone_user.connect(glance_keystone_role)
|
||||
@ -729,6 +746,7 @@ def setup_glance_registry(node, glance_api_puppet):
|
||||
glance_registry_puppet = vr.create('glance_registry_puppet', 'resources/glance_registry_puppet', {})[0]
|
||||
node.connect(glance_registry_puppet)
|
||||
glance_api_puppet.connect(glance_registry_puppet)
|
||||
evapi.add_react(glance_api_puppet.name, glance_registry_puppet.name, actions=('update',))
|
||||
# API and registry should not listen same ports
|
||||
# should not use the same log destination and a pipeline,
|
||||
# so disconnect them and restore the defaults
|
||||
@ -760,7 +778,7 @@ def validate():
|
||||
|
||||
|
||||
@click.command()
|
||||
def deploy():
|
||||
def create():
|
||||
r= {}
|
||||
r.update(setup_base())
|
||||
r.update(setup_keystone(r['node1'], r['librarian_node1'],
|
||||
@ -794,7 +812,7 @@ def deploy():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main.add_command(deploy)
|
||||
main.add_command(create)
|
||||
main()
|
||||
|
||||
if PROFILE:
|
||||
|
@ -5,6 +5,8 @@ $ip = $resource['input']['ip']['value']
|
||||
$db_user = $resource['input']['db_user']['value']
|
||||
$db_password = $resource['input']['db_password']['value']
|
||||
$db_name = $resource['input']['db_name']['value']
|
||||
$db_host = $resource['input']['db_host']['value']
|
||||
$db_port = $resource['input']['db_port']['value']
|
||||
|
||||
$database_connection = $resource['input']['database_connection']['value']
|
||||
$database_idle_timeout = $resource['input']['database_idle_timeout']['value']
|
||||
@ -60,7 +62,7 @@ $mysql_module = $resource['input']['mysql_module']['value']
|
||||
$sql_idle_timeout = $resource['input']['sql_idle_timeout']['value']
|
||||
|
||||
class {'cinder':
|
||||
database_connection => "mysql://${db_user}:${db_password}@${ip}/${db_name}",
|
||||
database_connection => "mysql://${db_user}:${db_password}@${db_host}:${db_port}/${db_name}",
|
||||
database_idle_timeout => $database_idle_timeout,
|
||||
database_min_pool_size => $database_min_pool_size,
|
||||
database_max_pool_size => $database_max_pool_size,
|
||||
|
@ -168,6 +168,9 @@ input:
|
||||
db_host:
|
||||
schema: str!
|
||||
value:
|
||||
db_port:
|
||||
schema: int!
|
||||
value:
|
||||
|
||||
port:
|
||||
schema: int!
|
||||
|
@ -5,6 +5,8 @@ $ip = $resource['input']['ip']['value']
|
||||
$db_user = $resource['input']['db_user']['value']
|
||||
$db_password = $resource['input']['db_password']['value']
|
||||
$db_name = $resource['input']['db_name']['value']
|
||||
$db_host = $resource['input']['db_host']['value']
|
||||
$db_port = $resource['input']['db_port']['value']
|
||||
|
||||
$filesystem_store_datadir = $resource['input']['filesystem_store_datadir']['value']
|
||||
|
||||
@ -84,7 +86,7 @@ class {'glance::api':
|
||||
key_file => $key_file,
|
||||
ca_file => $ca_file,
|
||||
known_stores => $known_stores,
|
||||
database_connection => "mysql://${db_user}:${db_password}@${ip}/${db_name}",
|
||||
database_connection => "mysql://${db_user}:${db_password}@${db_host}:${db_port}/${db_name}",
|
||||
database_idle_timeout => $database_idle_timeout,
|
||||
image_cache_dir => $image_cache_dir,
|
||||
os_region_name => $os_region_name,
|
||||
|
@ -150,6 +150,9 @@ input:
|
||||
db_host:
|
||||
schema: str!
|
||||
value:
|
||||
db_port:
|
||||
schema: int!
|
||||
value:
|
||||
|
||||
keystone_host:
|
||||
schema: str!
|
||||
|
@ -5,6 +5,8 @@ $ip = $resource['input']['ip']['value']
|
||||
$db_user = $resource['input']['db_user']['value']
|
||||
$db_password = $resource['input']['db_password']['value']
|
||||
$db_name = $resource['input']['db_name']['value']
|
||||
$db_host = $resource['input']['db_host']['value']
|
||||
$db_port = $resource['input']['db_port']['value']
|
||||
|
||||
$keystone_password = $resource['input']['keystone_password']['value']
|
||||
$package_ensure = $resource['input']['package_ensure']['value']
|
||||
@ -49,7 +51,7 @@ class {'glance::registry':
|
||||
bind_port => $bind_port,
|
||||
log_file => $log_file,
|
||||
log_dir => $log_dir,
|
||||
database_connection => "mysql://${db_user}:${db_password}@${ip}/${db_name}",
|
||||
database_connection => "mysql://${db_user}:${db_password}@${db_host}:${db_port}/${db_name}",
|
||||
database_idle_timeout => $database_idle_timeout,
|
||||
auth_type => $auth_type,
|
||||
auth_host => $auth_host,
|
||||
@ -69,4 +71,4 @@ class {'glance::registry':
|
||||
sync_db => $sync_db,
|
||||
mysql_module => $mysql_module,
|
||||
sql_idle_timeout => $sql_idle_timeout,
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +114,9 @@ input:
|
||||
db_host:
|
||||
schema: str!
|
||||
value:
|
||||
db_port:
|
||||
schema: str!
|
||||
value:
|
||||
|
||||
keystone_host:
|
||||
schema: str!
|
||||
|
@ -6,6 +6,7 @@ $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']
|
||||
$db_port = $resource['input']['db_port']['value']
|
||||
$admin_port = $resource['input']['admin_port']['value']
|
||||
$port = $resource['input']['port']['value']
|
||||
|
||||
@ -14,7 +15,7 @@ class {'keystone':
|
||||
verbose => true,
|
||||
catalog_type => 'sql',
|
||||
admin_token => $admin_token,
|
||||
database_connection => "mysql://$db_user:$db_password@$db_host/$db_name",
|
||||
database_connection => "mysql://$db_user:$db_password@$db_host:$db_port/$db_name",
|
||||
public_port => "$port",
|
||||
admin_port => "$admin_port",
|
||||
token_driver => 'keystone.token.persistence.backends.sql.Token'
|
||||
|
@ -18,6 +18,9 @@ input:
|
||||
db_host:
|
||||
schema: str!
|
||||
value:
|
||||
db_port:
|
||||
schema: int!
|
||||
value:
|
||||
|
||||
admin_port:
|
||||
schema: int!
|
||||
|
@ -6,3 +6,4 @@
|
||||
name: {{ resource_name }}
|
||||
image: {{ image }}
|
||||
state: absent
|
||||
- file: path=/var/lib/docker/data/{{resource_name}} state=absent
|
||||
|
@ -1,15 +1,18 @@
|
||||
- hosts: [{{host}}]
|
||||
sudo: yes
|
||||
tasks:
|
||||
- file: path=/var/lib/docker/data/{{resource_name}} state=directory
|
||||
- name: mariadb container
|
||||
docker:
|
||||
name: {{ resource_name }}
|
||||
image: {{ image }}
|
||||
state: running
|
||||
state: reloaded
|
||||
ports:
|
||||
- {{ port }}:3306
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: {{ root_password }}
|
||||
volumes:
|
||||
- /var/lib/docker/data/{{resource_name}}:/var/lib/mysql
|
||||
|
||||
- shell: docker exec -t {{ resource_name }} mysql -p{{ root_password }} -uroot -e "SELECT 1"
|
||||
register: result
|
||||
|
@ -4,6 +4,7 @@ $ip = $resource['input']['ip']['value']
|
||||
|
||||
$db_user = $resource['input']['db_user']['value']
|
||||
$db_host = $resource['input']['db_host']['value']
|
||||
$db_port = $resource['input']['db_port']['value']
|
||||
$db_password = $resource['input']['db_password']['value']
|
||||
$db_name = $resource['input']['db_name']['value']
|
||||
|
||||
@ -47,7 +48,7 @@ $report_interval = $resource['input']['report_interval']['value']
|
||||
class { 'neutron::server':
|
||||
enabled => true,
|
||||
manage_service => true,
|
||||
database_connection => "mysql://${db_user}:${db_password}@${db_host}/${db_name}",
|
||||
database_connection => "mysql://${db_user}:${db_password}@${db_host}:${db_port}/${db_name}",
|
||||
package_ensure => $package_ensure,
|
||||
auth_password => $auth_password,
|
||||
auth_type => $auth_type,
|
||||
@ -89,4 +90,4 @@ class { 'neutron::server':
|
||||
# Remove external class dependency
|
||||
Service <| title == 'neutron-server' |> {
|
||||
require => undef
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ input:
|
||||
db_host:
|
||||
schema: str!
|
||||
value:
|
||||
db_port:
|
||||
schema: int!
|
||||
value:
|
||||
|
||||
package_ensure:
|
||||
schema: str
|
||||
|
@ -19,4 +19,4 @@ class { 'nova::conductor':
|
||||
manage_service => true,
|
||||
ensure_package => $ensure_package,
|
||||
workers => $workers,
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ $db_user = $resource['input']['db_user']['value']
|
||||
$db_password = $resource['input']['db_password']['value']
|
||||
$db_name = $resource['input']['db_name']['value']
|
||||
$db_host = $resource['input']['db_host']['value']
|
||||
$db_port = $resource['input']['db_port']['value']
|
||||
$glance_api_servers_host = $resource['input']['glance_api_servers_host']['value']
|
||||
$glance_api_servers_port = $resource['input']['glance_api_servers_port']['value']
|
||||
|
||||
@ -72,7 +73,7 @@ $logdir = $resource['input']['logdir']['value']
|
||||
$os_region_name = $resource['input']['os_region_name']['value']
|
||||
|
||||
class { 'nova':
|
||||
database_connection => "mysql://${db_user}:${db_password}@${db_host}/${db_name}?charset=utf8",
|
||||
database_connection => "mysql://${db_user}:${db_password}@${db_host}:${db_port}/${db_name}?charset=utf8",
|
||||
ensure_package => $ensure_package,
|
||||
slave_connection => $slave_connection,
|
||||
database_idle_timeout => $database_idle_timeout,
|
||||
|
@ -205,6 +205,9 @@ input:
|
||||
db_host:
|
||||
schema: str!
|
||||
value:
|
||||
db_port:
|
||||
schema: int!
|
||||
value:
|
||||
|
||||
keystone_password:
|
||||
schema: str!
|
||||
|
Loading…
Reference in New Issue
Block a user