Working mariadb -> keystone -> haproxy connections

This commit is contained in:
Evgeniy L 2015-06-02 14:23:47 +02:00
parent ef108d4924
commit 75561285cf
18 changed files with 74 additions and 46 deletions

View File

@ -1,5 +1,5 @@
- hosts: [resource/docker]
- hosts: [{{ ip }}]
sudo: yes
tasks:
- shell: docker --version

View File

@ -4,9 +4,13 @@ version: 1.0.0
input:
ip:
schema: str!
value:
ssh_user:
schema: str!
value:
ssh_key:
schema: str!
value:
input-types:
tags: [resource/docker]
tags: [resources/docker]

View File

@ -1,4 +1,4 @@
id: haproxy
id: haproxy_config
handler: ansible
version: 1.0.0
input:
@ -27,4 +27,4 @@ input:
schema: str!
value:
tags: [resources/haproxy]
tags: [resources/haproxy, resource/haproxy_config]

View File

@ -10,9 +10,9 @@ input:
value: 9999
ports:
schema: [{value: int}]
value:
value: []
servers:
schema: [{value: str}]
value:
value: []
tags: [resources/haproxy, resource/haproxy_keystone_config]

View File

@ -8,7 +8,7 @@ input:
value: /etc/solar/keystone
admin_token:
schema: str!
value:
value: admin
db_password:
schema: str!
value: password

View File

@ -10,10 +10,10 @@ input:
value: /etc/solar/keystone
port:
schema: int!
value:
value: 5000
admin_port:
schema: int!
value:
value: 35357
ip:
schema: str!
value:

View File

@ -1,4 +1,4 @@
id: mariadb_table
id: mariadb_keystone_db
handler: ansible
version: 1.0.0
actions:
@ -7,16 +7,16 @@ actions:
input:
db_name:
schema: str!
value:
value: keystone_db
login_user:
schema: str!
value: root
login_password:
schema: str!
value:
login_port:
schema: int!
value:
login_user:
schema: str!
value:
ip:
schema: str!
value:
@ -27,4 +27,4 @@ input:
schema: str!
value:
tags: [resource/mariadb_table, resources/mariadb]
tags: [resource/mariadb_keystone_db, resources/mariadb]

View File

@ -1,4 +1,4 @@
id: mariadb_user
id: mariadb_keystone_user
handler: ansible
version: 1.0.0
actions:
@ -7,10 +7,10 @@ actions:
input:
new_user_password:
schema: str!
value:
value: keystone
new_user_name:
schema: str!
value:
value: keystone
db_name:
schema: str!
value:
@ -33,5 +33,5 @@ input:
schema: str!
value:
tags: [resource/mariadb_user, resources/mariadb]
tags: [resource/mariadb_keystone_user, resources/mariadb]

View File

@ -10,3 +10,9 @@
- {{ port }}:3306
env:
MYSQL_ROOT_PASSWORD: {{ root_password }}
- shell: docker exec -t {{ name }} mysql -p{{ root_password }} -uroot -e "SELECT 1"
register: result
until: result.rc == 0
retries: 20
delay: 0.5

View File

@ -1,4 +1,4 @@
id: mariadb
id: mariadb_service
handler: ansible
version: 1.0.0
input:
@ -21,4 +21,4 @@ input:
schema: str!
value:
tags: [resource/mariadb, resources/mariadb]
tags: [resource/mariadb_service, resources/mariadb]

View File

@ -10,33 +10,51 @@ extensions:
tags: {{tags}}
connections:
- for_resources: [resource/keystone_config]
filter_resources: [resource/mariadb]
- for_resources: [resource/mariadb_service]
filter_resources: [resource/mariadb_keystone_db, resource/mariadb_keystone_user]
mapping:
root_password: login_password
port: login_port
- for_resources: [resource/mariadb_keystone_db]
filter_resources: [resource/mariadb_keystone_user]
mapping:
db_name: db_name
- for_resources: [resource/mariadb_service]
filter_resources: [resource/keystone_config]
mapping:
ip: db_host
root_password: db_password
port: db_port
- for_resources: [resource/keystone_service]
filter_resources: [resources/haproxy]
- for_resources: [resource/mariadb_keystone_user]
filter_resources: [resource/keystone_config]
mapping:
servers: ip
ports: admin_port
db_name: db_name
new_user_name: db_user
new_user_password: db_password
# NOTE(dshulyak) it is mandatory for some profiles to user graph based
# api to provide order of execution for different events
run:
- containers.actions.clean_list
- docker.actions.run
- mariadb.actions.run
- mariadb.actions.wait
- mariadb.actions.users
- keystone.actions.run
- haproxy.actions.run
- containers.actions.ensure
- for_resources: [resource/keystone_config]
filter_resources: [resource/keystone_service]
mapping:
config_dir: config_dir
remove:
- haproxy.actions.remove
- keystone.actions.remove
- mariadb.actions.remove
- docker.actions.remove
- for_resources: [resource/keystone_service]
filter_resources: [resource/haproxy_keystone_config]
mapping:
ip: servers
port: ports
- for_resources: [resource/haproxy_keystone_config]
filter_resources: [resource/haproxy_config]
mapping:
listen_port: listen_ports
name: configs_names
ports: configs_ports
servers: configs
- for_resources: [resource/haproxy_config]
filter_resources: [resource/haproxy_service]
mapping:
listen_ports: ports
config_dir: host_binds