From 0f5af771ef8f68b2da0909ff4213c69af6a633d5 Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Sat, 28 Mar 2015 17:16:24 -0500 Subject: [PATCH] Initial commit for adding ansible support This adds a very basic structure to begin supporting ansible in Kolla. Ansible can support complete idempotency, but wrapping docker-compose does not allow idempotency at this time. These playbooks will be extended to compensate for that in future patches. Change-Id: I1c9e8d32321e2733f5a9b752edf74b4fe90317ed --- ansible/README.md | 42 +++++++++++++++++++++ ansible/inventory/all-in-one | 8 ++++ ansible/inventory/multinode | 14 +++++++ ansible/roles/database/tasks/main.yml | 3 ++ ansible/roles/message-broker/tasks/main.yml | 3 ++ ansible/site.yml | 10 +++++ 6 files changed, 80 insertions(+) create mode 100644 ansible/README.md create mode 100644 ansible/inventory/all-in-one create mode 100644 ansible/inventory/multinode create mode 100644 ansible/roles/database/tasks/main.yml create mode 100644 ansible/roles/message-broker/tasks/main.yml create mode 100644 ansible/site.yml diff --git a/ansible/README.md b/ansible/README.md new file mode 100644 index 0000000000..d1734ea30d --- /dev/null +++ b/ansible/README.md @@ -0,0 +1,42 @@ +Koalla - Kolla with ansible! +============================ + +Koalla extends the Kolla project past [TripleO][] into its own bonified +deployment system using [Ansible][] and [docker-compose][]. + +[TripleO]: https://wiki.openstack.org/wiki/TripleO +[Ansible]: https://docs.ansible.com +[docker-compose]: http://docs.docker.com/compose + + +Getting Started +=============== + +To run the ansible playbooks, you must specify an inventory file which tracks +all of the available nodes in your environment. With this inventory file +ansible will log into each node via ssh (configurable) and run tasks. Ansible +does not require password less logins via ssh, however it is highly recommended +to setup ssh-keys. More information on the ansible inventory file can be found +[here][]. + +[here]: https://docs.ansible.com/intro_inventory.html + + +Deploying +========= + +For AIO deploys, you can run the following commands. These will setup all of +the containers on your localhost. + +``` +$ cd ./kolla/ansible +$ ansible-playbook -i inventory/all-in-one site.yml +``` + + +Further Reading +=============== + +Ansible playbook documentation can be found [here][]. + +[here]: http://docs.ansible.com/playbooks.html diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one new file mode 100644 index 0000000000..246ce4e921 --- /dev/null +++ b/ansible/inventory/all-in-one @@ -0,0 +1,8 @@ +[support] +localhost ansible_connection=local + +[database:children] +support + +[message-broker:children] +support diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode new file mode 100644 index 0000000000..a14fc6726d --- /dev/null +++ b/ansible/inventory/multinode @@ -0,0 +1,14 @@ +[support] +# These hostname must be resolvable from your deployment host +support01 ansible_ssh_user=sam +support02 ansible_ssh_user=sam +support03 ansible_ssh_user=sam + +# The above can also be specified as follows: +#support[01:03] ansible_ssh_user=sam + +[database:children] +support + +[message-broker:children] +support diff --git a/ansible/roles/database/tasks/main.yml b/ansible/roles/database/tasks/main.yml new file mode 100644 index 0000000000..c624649c24 --- /dev/null +++ b/ansible/roles/database/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Bringing up mariadb service(s) + command: docker-compose -f /root/kolla/compose/mariadb.yml up -d diff --git a/ansible/roles/message-broker/tasks/main.yml b/ansible/roles/message-broker/tasks/main.yml new file mode 100644 index 0000000000..bec1f11d80 --- /dev/null +++ b/ansible/roles/message-broker/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Bringing up rabbitmq service(s) + command: docker-compose -f /root/kolla/compose/rabbitmq.yml up -d diff --git a/ansible/site.yml b/ansible/site.yml new file mode 100644 index 0000000000..feccbb0b38 --- /dev/null +++ b/ansible/site.yml @@ -0,0 +1,10 @@ +--- +- hosts: database + roles: + - database + tags: database + +- hosts: message-broker + roles: + - message-broker + tags: message-broker