summaryrefslogtreecommitdiffstats
path: root/deploy/adapters
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2017-01-23 15:38:52 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2017-02-04 14:39:32 +0800
commit53916ab0e407f29b33a72c721f424284567636ce (patch)
tree45c3574657ebecda7d34c707bab8ec61cd519408 /deploy/adapters
parentbf6f490bbac43392db6d0d3a5f27d4209b3967dc (diff)
Congress support for Newton
Modification: 1.Add congress support in deploy/compass_conf 2.Optimize congress role to be more independant. Separate congress role into install, keystone, database, start. 3.Support both ubuntu and centos Change-Id: I1c9a458addd84133652fb7c0563bc287d161d129 Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Diffstat (limited to 'deploy/adapters')
-rw-r--r--deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml1
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/roles/congress/handlers/main.yml0
-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
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/roles/congress/templates/api-paste.ini0
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/roles/congress/templates/congress.conf0
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/roles/congress/templates/congress.service (renamed from deploy/adapters/ansible/roles/congress/files/congress.service)2
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/roles/congress/templates/policy.json0
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/roles/congress/vars/Debian.yml9
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/roles/congress/vars/RedHat.yml (renamed from deploy/adapters/ansible/roles/congress/tasks/congress_config.yml)15
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/roles/congress/vars/main.yml22
14 files changed, 158 insertions, 23 deletions
diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
index 8398ca76..5e729cf3 100644
--- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
+++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
@@ -77,6 +77,7 @@
- dashboard
- heat
- aodh
+ - congress
- hosts: all
remote_user: root
diff --git a/deploy/adapters/ansible/roles/congress/handlers/main.yml b/deploy/adapters/ansible/roles/congress/handlers/main.yml
index b4ea8e90..b4ea8e90 100644..100755
--- a/deploy/adapters/ansible/roles/congress/handlers/main.yml
+++ b/deploy/adapters/ansible/roles/congress/handlers/main.yml
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
diff --git a/deploy/adapters/ansible/roles/congress/templates/api-paste.ini b/deploy/adapters/ansible/roles/congress/templates/api-paste.ini
index 39be570b..39be570b 100644..100755
--- a/deploy/adapters/ansible/roles/congress/templates/api-paste.ini
+++ b/deploy/adapters/ansible/roles/congress/templates/api-paste.ini
diff --git a/deploy/adapters/ansible/roles/congress/templates/congress.conf b/deploy/adapters/ansible/roles/congress/templates/congress.conf
index 0305b418..0305b418 100644..100755
--- a/deploy/adapters/ansible/roles/congress/templates/congress.conf
+++ b/deploy/adapters/ansible/roles/congress/templates/congress.conf
diff --git a/deploy/adapters/ansible/roles/congress/files/congress.service b/deploy/adapters/ansible/roles/congress/templates/congress.service
index 4ec26c8c..f92ee1b6 100644..100755
--- a/deploy/adapters/ansible/roles/congress/files/congress.service
+++ b/deploy/adapters/ansible/roles/congress/templates/congress.service
@@ -10,7 +10,7 @@ WorkingDirectory=/var/lib/congress
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/lock/congress /var/log/congress /var/lib/congress
ExecStartPre=/usr/bin/touch /var/log/congress/congress.log
-ExecStart=/usr/local/bin/congress-server --config-file /etc/congress/congress.conf
+ExecStart={{ congress_path }}/congress-server --config-file /etc/congress/congress.conf
Restart=on-failure
LimitNOFILE=65535
TimeoutStopSec=15
diff --git a/deploy/adapters/ansible/roles/congress/templates/policy.json b/deploy/adapters/ansible/roles/congress/templates/policy.json
index 4476051d..4476051d 100644..100755
--- a/deploy/adapters/ansible/roles/congress/templates/policy.json
+++ b/deploy/adapters/ansible/roles/congress/templates/policy.json
diff --git a/deploy/adapters/ansible/roles/congress/vars/Debian.yml b/deploy/adapters/ansible/roles/congress/vars/Debian.yml
index 36aba73e..1f0820c8 100644..100755
--- a/deploy/adapters/ansible/roles/congress/vars/Debian.yml
+++ b/deploy/adapters/ansible/roles/congress/vars/Debian.yml
@@ -7,15 +7,12 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
-packages:
+pip_packages:
- congress
- python-congressclient
- python-cloudfoundryclient
-service:
+services:
- congress
-credentials:
- - user: congress
- db: congress
- password: "{{ CONGRESS_DBPASS }}"
+congress_path: /usr/local/bin
diff --git a/deploy/adapters/ansible/roles/congress/tasks/congress_config.yml b/deploy/adapters/ansible/roles/congress/vars/RedHat.yml
index c85057e8..0b5e9678 100644..100755
--- a/deploy/adapters/ansible/roles/congress/tasks/congress_config.yml
+++ b/deploy/adapters/ansible/roles/congress/vars/RedHat.yml
@@ -7,11 +7,12 @@
# 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]
+pip_packages:
+ - congress
+ - python-congressclient
+ - python-cloudfoundryclient
-- name: start congress service
- shell: systemctl start congress.service
+services:
+ - congress
+
+congress_path: /usr/bin
diff --git a/deploy/adapters/ansible/roles/congress/vars/main.yml b/deploy/adapters/ansible/roles/congress/vars/main.yml
index f6fef749..18c4c845 100644..100755
--- a/deploy/adapters/ansible/roles/congress/vars/main.yml
+++ b/deploy/adapters/ansible/roles/congress/vars/main.yml
@@ -10,3 +10,25 @@
packages_noarch: []
services_noarch: []
+
+congress_service:
+ - name: congress
+ type: policy
+ region: RegionOne
+ description: "OpenStack Policy Service"
+ publicurl: "http://{{ public_vip.ip }}:1789"
+ internalurl: "http://{{ internal_vip.ip }}:1789"
+ adminurl: "http://{{ internal_vip.ip }}:1789"
+
+congress_user:
+ - user: congress
+ password: "{{ CONGRESS_PASS }}"
+ email: congress@admin.com
+ role: admin
+ tenant: service
+ tenant_description: "Service Tenant"
+
+congress_database:
+ - user: congress
+ db: congress
+ password: "{{ CONGRESS_DBPASS }}"