Rearanged the playbook to use ansible roles:

http://docs.ansible.com/ansible/playbooks_roles.html

also made keystone run
This commit is contained in:
erijpkema
2017-04-25 14:47:04 +02:00
parent de87cd66f2
commit 90b25a6d6c
15 changed files with 275 additions and 42 deletions

View File

@ -0,0 +1,38 @@
# Build keystone. It needs to be run with
# --add-host=mariadb:<ip mariadb listens tp>
# Wen starting with an initialized db,
# run keystone-manage db_sync from this docker first:
# $ docker run hpc/keystone --add-host=mariadb:<ip mariadb> "keystone-manage db_sync"
FROM python:2.7
# Clone the offical keystone repo and checkout ocata.
RUN git clone https://git.openstack.org/openstack/keystone.git -b stable/ocata
# all furter commands are done from /keystone directory.
WORKDIR /keystone
# Install python dependencies
RUN pip install MySQL-python==1.2.5 \
uWSGI==2.0.15 \
requests==2.12
# Install keystone.
RUN pip install .
#Install keystone settings files
RUN mkdir /etc/keystone
RUN cp -R etc/* /etc/keystone/
# configure keystone to connect to mariadb host.
RUN sed "s|database]|database]\nconnection = mysql://keystone:keystone@mariadb/keystone|g" /etc/keystone/keystone.conf.sample > /etc/keystone/keystone.conf
# set admin token TODO: make this a secret
RUN sed -i 's/#admin_token = ADMIN/admin_token = SuperSecreteKeystoneToken/g' /etc/keystone/keystone.conf
RUN mkdir /etc/keystone/fernet-keys
#RUN keystone-manage db_sync
CMD keystone-manage fernet_setup --keystone-user root --keystone-group root && \
uwsgi --http 127.0.0.1:35357 --wsgi-file /usr/local/bin/keystone-wsgi-admin

View File

@ -0,0 +1,14 @@
[Unit]
Description=Openstack Keystone Container
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStart=/usr/bin/docker run --name %n --add-host="mariadb:172.29.236.13" hpc/keystone
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,35 @@
# Build and install a docker image for keystone.
---
- include: ../common/tasks/docker.yml
- name: Make docker build dir
file:
path: /srv/keystone
state: directory
mode: 0755
- name: install Dockerfile
copy:
src: files/Dockerfile
dest: /srv/keystone
- name: build keystone image
docker_image:
path: /srv/keystone
name: hpc/keystone
- name: install service file.
template:
src: files/keystone.service
dest: /etc/systemd/system/keystone.service
mode: 644
owner: root
group: root
- name: install service file
command: systemctl daemon-reload
- name: make sure service is started
systemd:
name: keystone.service
state: started