Merge pull request #45 from xarses/keystone-db-deployment
Configured keystone, haproxy, mariadb
This commit is contained in:
commit
361ddc95b4
3
examples/check_deployment.sh
Executable file
3
examples/check_deployment.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker exec -it keystone-test keystone --debug --os-username admin --os-password password --os-tenant-name admin --os-auth-url http://10.0.0.3:8080/v2.0 role-list
|
@ -2,10 +2,12 @@ id: docker
|
|||||||
type: resource
|
type: resource
|
||||||
handler: ansible
|
handler: ansible
|
||||||
version: v1
|
version: v1
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
run: simple/docker/run.yml
|
run: simple/docker/run.yml
|
||||||
remove: simple/docker/remove.yml
|
remove: simple/docker/remove.yml
|
||||||
|
|
||||||
input:
|
input:
|
||||||
base_image: ubuntu
|
base_image: ubuntu
|
||||||
tags: [service/docker]
|
|
||||||
|
|
||||||
|
tags: [service/docker]
|
||||||
|
27
examples/resources/haproxy.yml
Normal file
27
examples/resources/haproxy.yml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
id: haproxy
|
||||||
|
type: resource
|
||||||
|
handler: ansible
|
||||||
|
version: v1
|
||||||
|
|
||||||
|
actions:
|
||||||
|
run: simple/haproxy/run.yml
|
||||||
|
remove: simple/haproxy/remove.yml
|
||||||
|
|
||||||
|
input:
|
||||||
|
name: haproxy
|
||||||
|
image: haproxy:1.5
|
||||||
|
services:
|
||||||
|
# TODO Here we should be able to remove hardcoded data,
|
||||||
|
# we can have sveral keystone backaends, and other different
|
||||||
|
# services. Without hardcoding of specific node we should
|
||||||
|
# get the nodes with specific tag.
|
||||||
|
# * get all nodes which use all tags with 'service/keystone'
|
||||||
|
# * iterate over this list here
|
||||||
|
# * pass correct port and ip address
|
||||||
|
- service_name: keystone
|
||||||
|
bind: "*:8080"
|
||||||
|
backends:
|
||||||
|
- remote_name: keystone-test
|
||||||
|
remote_addr: 10.0.0.3:35357
|
||||||
|
|
||||||
|
tags: [service/haproxy]
|
16
examples/resources/keystone.yml
Normal file
16
examples/resources/keystone.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
id: keystone
|
||||||
|
type: resource
|
||||||
|
handler: ansible
|
||||||
|
version: v1
|
||||||
|
|
||||||
|
actions:
|
||||||
|
run: simple/keystone/run.yml
|
||||||
|
remove: simple/keystone/remove.yml
|
||||||
|
|
||||||
|
input:
|
||||||
|
admin_port: 35357
|
||||||
|
public_port: 5000
|
||||||
|
name: keystone-test
|
||||||
|
image: kollaglue/centos-rdo-keystone
|
||||||
|
|
||||||
|
tags: [service/keystone]
|
@ -8,8 +8,9 @@ actions:
|
|||||||
wait: simple/mariadb/wait.yml
|
wait: simple/mariadb/wait.yml
|
||||||
users: simple/mariadb/users.yml
|
users: simple/mariadb/users.yml
|
||||||
input:
|
input:
|
||||||
name: maria-test
|
name: mariadb-test
|
||||||
image: tutum/mariadb
|
image: kollaglue/fedora-rdo-mariadb-app
|
||||||
|
root_password: test1
|
||||||
users:
|
users:
|
||||||
- name: test1
|
- name: test1
|
||||||
password: test1
|
password: test1
|
||||||
|
@ -7,4 +7,3 @@
|
|||||||
register: docker_version
|
register: docker_version
|
||||||
- shell: curl -sSL https://get.docker.com/ | sudo sh
|
- shell: curl -sSL https://get.docker.com/ | sudo sh
|
||||||
when: docker_version|failed
|
when: docker_version|failed
|
||||||
- shell: docker pull {{ docker.base_image }}
|
|
||||||
|
12
examples/resources/simple/haproxy/run.yml
Normal file
12
examples/resources/simple/haproxy/run.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
- hosts: [haproxy]
|
||||||
|
sudo: yes
|
||||||
|
tasks:
|
||||||
|
- file: state=directory path=/etc/solar/{{haproxy.name}}
|
||||||
|
# TODO Remove hardcoded path
|
||||||
|
- template: src=/vagrant/examples/resources/templates/haproxy.cfg.j2 dest=/etc/solar/{{haproxy.name}}/haproxy.cfg backup=yes
|
||||||
|
- shell: docker run -d \
|
||||||
|
--net="host" \
|
||||||
|
--privileged \
|
||||||
|
-v /etc/solar/{{haproxy.name}}/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro \
|
||||||
|
--name {{haproxy.name}} {{haproxy.image}}
|
9
examples/resources/simple/keystone/run.yml
Normal file
9
examples/resources/simple/keystone/run.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
- hosts: [keystone]
|
||||||
|
sudo: yes
|
||||||
|
tasks:
|
||||||
|
- shell: docker run -d --net="host" --privileged \
|
||||||
|
-e "DB_ROOT_PASSWORD={{mariadb.root_password}}" \
|
||||||
|
-e "KEYSTONE_PUBLIC_SERVICE_PORT={{keystone.public_port}}" \
|
||||||
|
-e "KEYSTONE_ADMIN_SERVICE_PORT={{keystone.admin_port}}" \
|
||||||
|
--name {{keystone.name}} {{keystone.image}}
|
@ -2,5 +2,10 @@
|
|||||||
- hosts: [mariadb]
|
- hosts: [mariadb]
|
||||||
sudo: yes
|
sudo: yes
|
||||||
tasks:
|
tasks:
|
||||||
- shell: docker run -d --net="host" --privileged \
|
- shell: docker run \
|
||||||
--name {{mariadb.name}} {{mariadb.image}}
|
-d \
|
||||||
|
--net="host" \
|
||||||
|
--privileged \
|
||||||
|
--name {{mariadb.name}} \
|
||||||
|
-e "MARIADB_ROOT_PASSWORD={{mariadb.root_password}}" \
|
||||||
|
{{mariadb.image}}
|
||||||
|
@ -3,9 +3,10 @@
|
|||||||
sudo: yes
|
sudo: yes
|
||||||
tasks:
|
tasks:
|
||||||
- command: docker exec -t {{mariadb.name}} \
|
- command: docker exec -t {{mariadb.name}} \
|
||||||
mysql -uroot \
|
mysql -uroot -p{{mariadb.root_password}} \
|
||||||
-e "CREATE USER '{{item.name}}'@'%' IDENTIFIED BY '{{item.password}}'"
|
-e "CREATE USER '{{item.name}}'@'%' IDENTIFIED BY '{{item.password}}'"
|
||||||
with_items: mariadb.users
|
with_items: mariadb.users
|
||||||
|
|
||||||
- command: docker exec -t {{mariadb.name}} \
|
- command: docker exec -t {{mariadb.name}} \
|
||||||
mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO '{{item.name}}'@'%' WITH GRANT OPTION"
|
mysql -uroot -p{{mariadb.root_password}} -e "GRANT ALL PRIVILEGES ON *.* TO '{{item.name}}'@'%' WITH GRANT OPTION"
|
||||||
with_items: mariadb.users
|
with_items: mariadb.users
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
- hosts: [mariadb]
|
- hosts: [mariadb]
|
||||||
sudo: yes
|
sudo: yes
|
||||||
tasks:
|
tasks:
|
||||||
- shell: docker exec -t {{mariadb.name}} mysql -uroot -e "select 1"
|
- shell: docker exec -t {{mariadb.name}} mysql -p{{mariadb.root_password}} -uroot -e "select 1"
|
||||||
register: result
|
register: result
|
||||||
until: result.rc == 0
|
until: result.rc == 0
|
||||||
retries: 10
|
retries: 10
|
||||||
|
26
examples/resources/templates/haproxy.cfg.j2
Normal file
26
examples/resources/templates/haproxy.cfg.j2
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
global
|
||||||
|
maxconn 4096
|
||||||
|
pidfile /var/run/haproxy.pidfile
|
||||||
|
defaults
|
||||||
|
mode tcp
|
||||||
|
timeout connect 5s
|
||||||
|
timeout client 1m
|
||||||
|
timeout server 1m
|
||||||
|
option redispatch
|
||||||
|
balance roundrobin
|
||||||
|
|
||||||
|
listen stats :1936
|
||||||
|
mode http
|
||||||
|
stats enable
|
||||||
|
stats hide-version
|
||||||
|
#stats realm Haproxy\ Statistics
|
||||||
|
stats uri /
|
||||||
|
#stats auth Username:Password
|
||||||
|
|
||||||
|
{% for service in haproxy.services %}
|
||||||
|
listen {{ service.service_name }}
|
||||||
|
bind {{service.bind}}
|
||||||
|
{% for backend in service.backends %}
|
||||||
|
server {{ backend.remote_name }} {{ backend.remote_addr }} check inter 2s rise 3 fall 2
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
@ -16,6 +16,8 @@ run:
|
|||||||
- mariadb.actions.run
|
- mariadb.actions.run
|
||||||
- mariadb.actions.wait
|
- mariadb.actions.wait
|
||||||
- mariadb.actions.users
|
- mariadb.actions.users
|
||||||
|
- keystone.actions.run
|
||||||
|
- haproxy.actions.run
|
||||||
|
|
||||||
remove:
|
remove:
|
||||||
- mariadb.actions.remove
|
- mariadb.actions.remove
|
||||||
|
Loading…
x
Reference in New Issue
Block a user