summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/congress/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/congress/tasks')
-rw-r--r--deploy/adapters/ansible/roles/congress/tasks/congress_config.yml17
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/roles/congress/tasks/congress_database.yml (renamed from deploy/adapters/ansible/roles/congress/tasks/congress_db.yml)13
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/roles/congress/tasks/congress_install.yml10
-rwxr-xr-xdeploy/adapters/ansible/roles/congress/tasks/congress_keystone.yml70
-rwxr-xr-xdeploy/adapters/ansible/roles/congress/tasks/congress_start.yml12
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/roles/congress/tasks/main.yml27
6 files changed, 123 insertions, 26 deletions
diff --git a/deploy/adapters/ansible/roles/congress/tasks/congress_config.yml b/deploy/adapters/ansible/roles/congress/tasks/congress_config.yml
deleted file mode 100644
index c85057e8..00000000
--- a/deploy/adapters/ansible/roles/congress/tasks/congress_config.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
----
-- name: congress db sync
- shell: |
- /usr/local/bin/congress-db-manage \
- --config-file /etc/congress/congress.conf upgrade head
- when: inventory_hostname == haproxy_hosts.keys()[0]
-
-- name: start congress service
- shell: systemctl start congress.service
diff --git a/deploy/adapters/ansible/roles/congress/tasks/congress_db.yml b/deploy/adapters/ansible/roles/congress/tasks/congress_database.yml
index 16832eaa..009e3488 100644..100755
--- a/deploy/adapters/ansible/roles/congress/tasks/congress_db.yml
+++ b/deploy/adapters/ansible/roles/congress/tasks/congress_database.yml
@@ -1,4 +1,4 @@
-##############################################################################
+#############################################################################
# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
@@ -12,7 +12,7 @@
login_unix_socket: /var/run/mysqld/mysqld.sock
name: "{{ item.db }}"
state: present
- with_items: "{{ credentials }}"
+ with_items: "{{ congress_database }}"
- name: create congress db user
mysql_user:
@@ -23,5 +23,12 @@
host: "{{ item[1] }}"
state: present
with_nested:
- - "{{ credentials }}"
+ - "{{ congress_database }}"
- ['%', 'localhost']
+
+- name: congress db sync
+ shell: |
+ "{{ congress_path }}"/congress-db-manage \
+ --config-file /etc/congress/congress.conf upgrade head
+ notify:
+ - restart congress services
diff --git a/deploy/adapters/ansible/roles/congress/tasks/congress_install.yml b/deploy/adapters/ansible/roles/congress/tasks/congress_install.yml
index 4269b5e6..40d5d78e 100644..100755
--- a/deploy/adapters/ansible/roles/congress/tasks/congress_install.yml
+++ b/deploy/adapters/ansible/roles/congress/tasks/congress_install.yml
@@ -7,11 +7,9 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
-- include_vars: "{{ ansible_os_family }}.yml"
-
- name: install congress packages
pip: name={{ item }} state=present
- with_items: "{{ packages }}"
+ with_items: "{{ pip_packages | union(packages_noarch) }}"
- name: create congress etc directory
file: path=/etc/congress state=directory
@@ -23,9 +21,13 @@
- congress.conf
- api-paste.ini
- policy.json
+ notify:
+ - restart congress services
- name: create congress service
- copy: src=congress.service dest=/lib/systemd/system/
+ template: src=congress.service dest=/lib/systemd/system/
+ notify:
+ - restart congress services
- name: create congress service work dir
file: path=/var/lib/congress state=directory
diff --git a/deploy/adapters/ansible/roles/congress/tasks/congress_keystone.yml b/deploy/adapters/ansible/roles/congress/tasks/congress_keystone.yml
new file mode 100755
index 00000000..b7f00b88
--- /dev/null
+++ b/deploy/adapters/ansible/roles/congress/tasks/congress_keystone.yml
@@ -0,0 +1,70 @@
+##############################################################################
+# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
+---
+- name: add service
+ os_keystone_service:
+ cloud: opnfv
+ name: "{{ item.name }}"
+ description: "{{ item.description }}"
+ service_type: "{{ item.type }}"
+ with_items: "{{ congress_service }}"
+
+- name: add user
+ os_user:
+ cloud: opnfv
+ domain: default
+ name: "{{ item.user }}"
+ password: "{{ item.password }}"
+ default_project: "{{ item.tenant }}"
+ email: "{{ item.email }}"
+ with_items: "{{ congress_user }}"
+
+- name: grant roles
+ os_user_role:
+ cloud: opnfv
+ user: "{{ item.user }}"
+ role: "{{ item.role }}"
+ project: "{{ item.tenant }}"
+ with_items: "{{ congress_user }}"
+
+- name: create admin url for service's endpoint
+ keystone_endpoint:
+ cloud: opnfv
+ endpoint_type: admin
+ name: "{{ item.name }}"
+ service_type: "{{ item.type }}"
+ state: present
+ interface: admin
+ region: "{{ item.region}}"
+ url: "{{ item.adminurl }}"
+ with_items: "{{ congress_service }}"
+
+- name: create internal url for service's endpoint
+ keystone_endpoint:
+ cloud: opnfv
+ endpoint_type: admin
+ name: "{{ item.name }}"
+ service_type: "{{ item.type }}"
+ state: present
+ interface: internal
+ region: "{{ item.region}}"
+ url: "{{ item.internalurl }}"
+ with_items: "{{ congress_service }}"
+
+- name: create public url for service'e endpoint
+ keystone_endpoint:
+ cloud: opnfv
+ endpoint_type: admin
+ name: "{{ item.name }}"
+ service_type: "{{ item.type }}"
+ state: present
+ interface: public
+ region: "{{ item.region}}"
+ url: "{{ item.publicurl }}"
+ with_items: "{{ congress_service }}"
diff --git a/deploy/adapters/ansible/roles/congress/tasks/congress_start.yml b/deploy/adapters/ansible/roles/congress/tasks/congress_start.yml
new file mode 100755
index 00000000..1d7d5e52
--- /dev/null
+++ b/deploy/adapters/ansible/roles/congress/tasks/congress_start.yml
@@ -0,0 +1,12 @@
+##############################################################################
+## Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
+##
+## All rights reserved. This program and the accompanying materials
+## are made available under the terms of the Apache License, Version 2.0
+## which accompanies this distribution, and is available at
+## http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
+---
+- name: start congress services
+ service: name={{ item }} state=started enabled=yes
+ with_items: "{{ services | union(services_noarch) }}"
diff --git a/deploy/adapters/ansible/roles/congress/tasks/main.yml b/deploy/adapters/ansible/roles/congress/tasks/main.yml
index f8056d15..6aad108f 100644..100755
--- a/deploy/adapters/ansible/roles/congress/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/congress/tasks/main.yml
@@ -7,10 +7,33 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
+- include_vars: "{{ ansible_os_family }}.yml"
+ tags:
+ - install
+ - start
+
- include: congress_install.yml
+ tags:
+ - install
-- include: congress_db.yml
+- include: congress_keystone.yml
when:
- inventory_hostname == haproxy_hosts.keys()[0]
+ tags:
+ - keystone
+
+- include: congress_database.yml
+ when:
+ - inventory_hostname == haproxy_hosts.keys()[0]
+ tags:
+ - database
+
+- include: congress_start.yml
+ tags:
+ - start
-- include: congress_config.yml
+- meta: flush_handlers
+ tags:
+ - install
+ - keystone
+ - database