From c88c62db72a260a76d8c4e61bb5d072d00f6354f Mon Sep 17 00:00:00 2001 From: Taseer Ahmed Date: Fri, 6 Oct 2017 21:18:26 +0500 Subject: [PATCH] Add congress installation, db setup Signed-off-by: Taseer Ahmed --- defaults/main.yml | 2 ++ tasks/congress_db_setup.yml | 22 ++++++++++++++++++++++ tasks/congress_install.yml | 8 +++++++- tasks/congress_post_install.yml | 4 ---- tasks/main.yml | 10 +++++++--- 5 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 tasks/congress_db_setup.yml diff --git a/defaults/main.yml b/defaults/main.yml index d905351..d61c8d0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -27,6 +27,8 @@ congress_bin: "/openstack/venvs/congress-{{ congress_venv_tag }}/bin" congress_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/congress.tgz +congress_etc_dir: "{{ congress_bin | dirname }}/etc/congress" + ## Required PIP packages congress_requires_pip_packages: - tox diff --git a/tasks/congress_db_setup.yml b/tasks/congress_db_setup.yml new file mode 100644 index 0000000..b07ec25 --- /dev/null +++ b/tasks/congress_db_setup.yml @@ -0,0 +1,22 @@ +--- +# Copyright 2017, taseer94@gmail.com +# All rights reserved. +# +# 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. + +- name: create congress database schema + command: "{{ congress_bin }}/congress-db-manage + --config-file {{ congress_etc_dir }}/congress.conf upgrade head" + become: yes + become_user: "{{ congress_system_user_name }}" + changed_when: False \ No newline at end of file diff --git a/tasks/congress_install.yml b/tasks/congress_install.yml index f5c10ef..5cd38f3 100644 --- a/tasks/congress_install.yml +++ b/tasks/congress_install.yml @@ -102,4 +102,10 @@ dest: "/etc/ansible/facts.d/openstack_ansible.fact" section: congress option: venv_tag - value: "{{ congress_venv_tag }}" \ No newline at end of file + value: "{{ congress_venv_tag }}" + +- name: Install congress from source + shell: python setup.py install + +- name: Generate congress configuration + shell: tox -egenconfig \ No newline at end of file diff --git a/tasks/congress_post_install.yml b/tasks/congress_post_install.yml index 1af0325..2cc6de5 100644 --- a/tasks/congress_post_install.yml +++ b/tasks/congress_post_install.yml @@ -14,10 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: create congress database schema - shell: > - /usr/bin/congress-db-manage --config /etc/congress/congress.conf upgrade head - - name: install congress client pip: name: python-congressclient diff --git a/tasks/main.yml b/tasks/main.yml index b0fa418..5245b05 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -14,12 +14,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -- debug: - msg: "This script will call the installation tasks" - - include: congress_pre_install.yml + - include: congress_install.yml + #- include: congress_post_install.yml + - include: congress_service_setup.yml + when: > + inventory_hostname == groups['congress_all'][0] + +- include: congress_db_setup.yml when: > inventory_hostname == groups['congress_all'][0] \ No newline at end of file