replaced hardcoded ips with env vars

This commit is contained in:
Egon Rijpkema 2017-07-11 09:17:53 +02:00
parent f5d240a7f5
commit 062fabd4b6
4 changed files with 39 additions and 23 deletions

View File

@ -1,5 +0,0 @@
---
- hosts: database
become: True
roles:
- mariadb

View File

@ -1,4 +1,8 @@
---
- hosts: all
name: Dummy to gather facts
tasks: []
- hosts: glance
become: True
roles:

30
hosts
View File

@ -1,21 +1,41 @@
[databases]
ansible-test
openstack01-node02
[keystone]
ansible-test
openstack01-node03
[dockerregistry]
openstack01-node01
[glance]
openstack01-node02
[horizon]
kolla2
[rabbitmq]
ansible-test
ansible-test-2
ansible-test-3
openstack01-node01
openstack01-node02
openstack01-node03
[cassandra]
openstack01-node[01:03]
[first_cassandra]
openstack01-node01
[next_cassandra]
openstack01-node02
openstack01-node03
[memcached]
openstack01-node03
[first_cassandra:vars]
run_options=""
[next_cassandra:vars]
run_options="-e CASSANDRA_SEEDS=172.23.41.1"
[nova-management]
kolla2

View File

@ -8,18 +8,6 @@
with_items:
- /srv/glance
## Todo: remove this when we have a docker repo
#- name: clone docker-glance repo
# git:
# accept_hostkey: True
# repo: ssh://git@git.webhosting.rug.nl:222/P256174/docker-glance.git
# dest: /srv/glance
- name: build glance image
docker_image:
path: /srv/glance
name: hpc/openstack-glance
- name: install service file.
template:
src: templates/glance.service
@ -31,7 +19,16 @@
- command: systemctl daemon-reload
- name: Initialize database.
command: docke run --rm hpc/openstack-glance /etc/bootstrap.sh
command: >
docker run --rm
-e "RABBIT_HOST={{ hostvars[groups['rabbitmq'][0]]['ansible_default_ipv4']['address'] }}"
-e "MEMCACHED_HOST={{ hostvars[groups['memcached'][0]]['ansible_default_ipv4']['address'] }}"
-e "MYSQL_HOST={{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}"
-e "MYSQL_ROOT_PASSWORD=geheim"
-e "KEYSTONE_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}"
-e "GLANCE_HOST={{ hostvars[groups['glance'][0]]['ansible_default_ipv4']['address'] }}"
-e "GLANCE_PASSWORD=geheim"
hpc/openstack-glance /etc/bootstrap.sh
tags: bootstrap
- name: make sure service is started