diff --git a/utils/molteniron-playbook.yml b/utils/molteniron-playbook.yml new file mode 100644 index 0000000..4f516ac --- /dev/null +++ b/utils/molteniron-playbook.yml @@ -0,0 +1,95 @@ +# Copyright (c) 2017 IBM Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Example commands to configure the ansible controller: +# +# ubuntu@hamzy-dev:~$ cat << __EOF__ | sudo tee -a /etc/ansible/hosts +# # @BEGIN +# 9.114.111.114 +# hamzy-test ansible_host=9.114.111.114 +# +# [molteniron] +# hamzy-test +# # @END +# __EOF__ +# ubuntu@hamzy-dev:~$ ansible molteniron -m ping +# hamzy-test | SUCCESS => { +# "changed": false, +# "ping": "pong" +# } +# +# Remember to add the controller's public ssh key to: +# ubuntu@9.114.111.114/24:/home/ubuntu/.ssh/authorized_keys +# +# Example command to deploy a molteniron server on a fresh install of +# Ubuntu 16.04: +# +# ubuntu@hamzy-dev:~$ ansible-playbook molteniron-playbook.yml -f 10 +# + +--- +- name: deploy molteniron server + hosts: molteniron +# strategy: debug + gather_facts: yes + become: true + become_user: root + become_method: 'sudo' + + tasks: + + - name: install base packages + apt: pkg={{item}} state=present update_cache=yes cache_valid_time=604800 + with_items: + - sysstat + - build-essential + - python-dev + - python3-dev + - libmysqlclient-dev + - tox + - python2.7 + - python3.5 + - python-pip + - python-mysqldb + - mysql-server + + - name: start mysql server + service: name=mysql state=started enabled=yes + + - name: instal molteniron source code from git + git: repo=git://git.openstack.org/openstack/molteniron.git dest=/home/ubuntu/molteniron version=HEAD + + - name: pip install molteniron from git repository + shell: pip install -U --force-reinstall -r requirements.txt > pip_install.log 2>&1 + args: + chdir: /home/ubuntu/molteniron + creates: /home/ubuntu/molteniron/pip_install.log + + - name: python install molteniron from git repository + shell: python setup.py install > python_install.log 2>&1 + args: + chdir: /home/ubuntu/molteniron + creates: /home/ubuntu/molteniron/python_install.log + + - name: authorize openstack_citest MYSQL access + mysql_user: login_user=root login_password="" check_implicit_admin=yes name=openstack_citest password=openstack_citest priv="*.*:ALL,GRANT" state=present + + # @TODO(hamzy) handle case where server is already running + - name: start molteniron server + shell: moltenirond-helper start + + - name: run the molteniron status command + shell: molteniron --output=result status --type=human