Some speedups after adding PG

- ansible is running only once now
- more dynamic waiting for postgress

Change-Id: I9951312680aa2a80af201166f203bc9112cfcfb3
Partial-bug: #1546205
This commit is contained in:
Łukasz Oleś 2016-02-18 17:18:14 +01:00
parent 302affe6aa
commit bf5117508c
3 changed files with 11 additions and 10 deletions

View File

@ -8,9 +8,14 @@
POSTGRES_USER: solar
POSTGRES_PASSWORD: solar
POSTGRES_DATABASE: solar
- wait_for: host=127.0.0.1 port=5432 timeout=15 delay=1
- shell: docker exec vagrant_pg_1 gosu postgres psql -c "DROP DATABASE solar;"
- shell: docker exec vagrant_pg_1 gosu postgres psql -c "CREATE DATABASE solar WITH owner=postgres LC_COLLATE='C' TEMPLATE template0;"
- name: Waiting for postgresql in container
shell: docker exec vagrant_pg_1 psql -h localhost -U solar -c "SELECT NOW();"
register: result
until: result.rc == 0
retries: 15
delay: 1
- shell: docker exec vagrant_pg_1 psql -h localhost -U solar postgres -c "DROP DATABASE solar;"
- shell: docker exec vagrant_pg_1 psql -h localhost -U solar postgres -c "CREATE DATABASE solar WITH owner=postgres LC_COLLATE='C' TEMPLATE template0;"
- lineinfile:
dest: /.solar_config_override
line: "solar_db: postgresql://solar:solar@127.0.0.1:5432/solar"

View File

@ -1,6 +1,6 @@
---
- hosts: all
- hosts: localhost
sudo: yes
vars:
ssh_ip_mask: "10.*.*.*"
@ -12,7 +12,7 @@
- shell: pip install git+git://github.com/Mirantis/solar-agent.git
- include: tasks/ssh_conf.yaml
- hosts: all
- hosts: localhost
tasks:
# setup solar-resources
# change to openstack/solar-resources later

View File

@ -65,13 +65,9 @@ set -e
# wait for riak
if [ $SOLAR_DB_BACKEND == "riak" ]
if [ ${SOLAR_DB_BACKEND} == "riak" ]
then
sudo docker exec vagrant_riak_1 riak-admin wait_for_service riak_kv;
elif [ $SOLAR_DB_BACKEND == "postgres" ]
then
# TODO: Should be replaced with something smarter
sleep 5
fi
export SOLAR_CONFIG_OVERRIDE="/.solar_config_override"