aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters
diff options
context:
space:
mode:
authorYifei Xue <xueyifei@huawei.com>2016-03-11 16:39:50 +0800
committerYifei Xue <xueyifei@huawei.com>2016-03-11 16:45:58 +0800
commitcbfac2e20c14596c17ec0eee3dfa9c3cdcdeca31 (patch)
tree28e44a5785d449cfd5e9071fa03d955d58205142 /deploy/adapters
parentfd79871eacc5e23532ba2b45381c2c2d7a468761 (diff)
Add Tacker support for Compass
JIRA: COMPASS-339 only ubuntu supported currently Change-Id: I14bae2b11a811c1131eba1d25f57783dffbb0b51 Signed-off-by: Yifei Xue <xueyifei@huawei.com>
Diffstat (limited to 'deploy/adapters')
-rw-r--r--deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml6
-rwxr-xr-xdeploy/adapters/ansible/roles/tacker/tasks/main.yml14
-rwxr-xr-xdeploy/adapters/ansible/roles/tacker/tasks/tacker_controller.yml128
-rw-r--r--deploy/adapters/ansible/roles/tacker/templates/haproxy-tacker-cfg.j210
-rw-r--r--deploy/adapters/ansible/roles/tacker/templates/ml2_conf.j22
-rw-r--r--deploy/adapters/ansible/roles/tacker/templates/tacker.j229
-rwxr-xr-xdeploy/adapters/ansible/roles/tacker/vars/Debian.yml14
-rwxr-xr-xdeploy/adapters/ansible/roles/tacker/vars/RedHat.yml14
-rwxr-xr-xdeploy/adapters/ansible/roles/tacker/vars/main.yml19
9 files changed, 236 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
index 20f1f197..66e568ac 100644
--- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
+++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
@@ -223,3 +223,9 @@
roles:
- ext-network
+- hosts: controller
+ remote_user: root
+ accelerate: true
+ max_fail_percentage: 0
+ roles:
+ - tacker
diff --git a/deploy/adapters/ansible/roles/tacker/tasks/main.yml b/deploy/adapters/ansible/roles/tacker/tasks/main.yml
new file mode 100755
index 00000000..2759e968
--- /dev/null
+++ b/deploy/adapters/ansible/roles/tacker/tasks/main.yml
@@ -0,0 +1,14 @@
+##############################################################################
+# 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
+##############################################################################
+---
+- include_vars: "{{ ansible_os_family }}.yml"
+
+- name: Install Tacker on Controller
+ include: tacker_controller.yml
+ when: inventory_hostname in groups['controller'] and ansible_os_family == "Debian"
diff --git a/deploy/adapters/ansible/roles/tacker/tasks/tacker_controller.yml b/deploy/adapters/ansible/roles/tacker/tasks/tacker_controller.yml
new file mode 100755
index 00000000..d5e70e1a
--- /dev/null
+++ b/deploy/adapters/ansible/roles/tacker/tasks/tacker_controller.yml
@@ -0,0 +1,128 @@
+##############################################################################
+# 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: get http server
+ shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
+ register: http_server
+
+- name: creat tacker_home, tacker_client_home, tacker_horizon_home
+ shell: >
+ mkdir -p /opt/tacker
+ mkdir -p /opt/tacker_client
+ mkdir -p /opt/tacker_horizon
+
+- name: download tacker package
+ get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/tacker/{{ tacker_pkg_name }}" dest=/opt/{{ tacker_pkg_name }}
+
+- name: download tacker_client package
+ get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/tacker/{{ tacker_client_pkg_name }}" dest=/opt/{{ tacker_client_pkg_name }}
+
+- name: download tacker_horizon package
+ get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/tacker/{{ tacker_horizon_pkg_name }}" dest=/opt/{{ tacker_horizon_pkg_name }}
+
+- name: extract tacker package
+ command: su -s /bin/sh -c "tar xzf /opt/{{ tacker_pkg_name }} -C {{ tacker_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files"
+
+- name: extract tacker_client package
+ command: su -s /bin/sh -c "tar xzf /opt/{{ tacker_client_pkg_name }} -C {{ tacker_client_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files"
+
+- name: extract tacker_horizon package
+ command: su -s /bin/sh -c "tar xzf /opt/{{ tacker_horizon_pkg_name }} -C {{ tacker_horizon_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files"
+
+- name: edit ml2_conf.ini
+ shell: crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security;
+
+- name: Restart neutron-server
+ service: name=neutron-server state=restarted
+
+- name: "create haproxy configuration for tacker"
+ template:
+ src: "haproxy-tacker-cfg.j2"
+ dest: "/tmp/haproxy-tacker.cfg"
+
+- name: "combination of the haproxy configuration"
+ shell: "cat /tmp/haproxy-tacker.cfg >> /etc/haproxy/haproxy.cfg"
+
+- name: "delete temporary configuration file"
+ file:
+ dest: "/tmp/haproxy-tacker.cfg"
+ state: "absent"
+
+- name: "restart haproxy"
+ service:
+ name: "haproxy"
+ state: "restarted"
+
+- name: drop and recreate tacker database
+ shell: mysql -e "drop database if exists tacker;";
+ mysql -e "create database tacker character set utf8;";
+ mysql -e "grant all on tacker.* to 'tacker'@'%' identified by 'TACKER_DBPASS';";
+ when: inventory_hostname == haproxy_hosts.keys()[0]
+
+- name: create tacker user with admin privileges
+ shell: . /opt/admin-openrc.sh; openstack user create --password console tacker; openstack role add --project service --user tacker admin;
+ when: inventory_hostname == haproxy_hosts.keys()[0]
+
+- name: creat tacker service
+ shell: >
+ . /opt/admin-openrc.sh; openstack service create --name tacker --description "Tacker Project" nfv-orchestration
+ when: inventory_hostname == haproxy_hosts.keys()[0]
+
+- name: provide an endpoint to tacker service
+ shell: >
+ . /opt/admin-openrc.sh; openstack endpoint create --region RegionOne \
+ --publicurl 'http://{{ public_vip.ip }}:8890/' \
+ --adminurl 'http://{{ internal_vip.ip }}:8890/' \
+ --internalurl 'http://{{ internal_vip.ip }}:8890/' tacker
+ when: inventory_hostname == haproxy_hosts.keys()[0]
+
+- name: install tacker
+ shell: >
+ . /opt/admin-openrc.sh; pip install tosca-parser; cd {{ tacker_home }}; python setup.py install
+
+# - name: create 'tacker' directory in '/var/cache', set ownership and permissions
+# shell: >
+# sudo mkdir /var/cache/tacker
+# sudo chown <LOGIN_USER>:root /var/cache/tacker
+# sudo chmod 700 /var/cache/tacker
+
+- name: create 'tacker' directory in '/var/log'
+ shell: mkdir -p /var/log/tacker
+
+- name: copy tacker configs
+ template: src={{ item.src }} dest=/opt/os_templates
+ with_items: "{{ tacker_configs_templates }}"
+
+- name: edit tacker configuration file
+ shell: crudini --merge /usr/local/etc/tacker/tacker.conf < /opt/os_templates/tacker.j2
+
+#- name: populate tacker database
+# shell: >
+# . /opt/admin-openrc.sh; /usr/local/bin/tacker-db-manage --config-file /usr/local/etc/tacker/tacker.conf upgrade head
+
+- name: install tacker client
+ shell: >
+ . /opt/admin-openrc.sh; cd {{ tacker_client_home }}; python setup.py install
+
+- name: install tacker horizon
+ shell: >
+ . /opt/admin-openrc.sh; cd {{ tacker_horizon_home }}; python setup.py install
+
+- name: enable tacker horizon in dashboard
+ shell: >
+ cp {{ tacker_horizon_home }}/openstack_dashboard_extensions/* /usr/share/openstack-dashboard/openstack_dashboard/enabled/
+
+- name: restart apache server
+ shell: service apache2 restart
+
+- name: launch tacker-server
+ shell: >
+ . /opt/admin-openrc.sh; python /usr/local/bin/tacker-server --config-file /usr/local/etc/tacker/tacker.conf --log-file /var/log/tacker/tacker.log
+ async: 9999999999999
+ poll: 0
diff --git a/deploy/adapters/ansible/roles/tacker/templates/haproxy-tacker-cfg.j2 b/deploy/adapters/ansible/roles/tacker/templates/haproxy-tacker-cfg.j2
new file mode 100644
index 00000000..796e59e8
--- /dev/null
+++ b/deploy/adapters/ansible/roles/tacker/templates/haproxy-tacker-cfg.j2
@@ -0,0 +1,10 @@
+listen proxy-tacker_api_cluster
+ bind {{ internal_vip.ip }}:8890
+ bind {{ public_vip.ip }}:8890
+ mode tcp
+ option tcp-check
+ option tcplog
+ balance source
+{% for host,ip in haproxy_hosts.items() %}
+ server {{ host }} {{ ip }}:8890 weight 1 check inter 2000 rise 2 fall 5
+{% endfor %}
diff --git a/deploy/adapters/ansible/roles/tacker/templates/ml2_conf.j2 b/deploy/adapters/ansible/roles/tacker/templates/ml2_conf.j2
new file mode 100644
index 00000000..a5ccdaf4
--- /dev/null
+++ b/deploy/adapters/ansible/roles/tacker/templates/ml2_conf.j2
@@ -0,0 +1,2 @@
+[ml2]
+extension_drivers = port_security
diff --git a/deploy/adapters/ansible/roles/tacker/templates/tacker.j2 b/deploy/adapters/ansible/roles/tacker/templates/tacker.j2
new file mode 100644
index 00000000..1b9add7f
--- /dev/null
+++ b/deploy/adapters/ansible/roles/tacker/templates/tacker.j2
@@ -0,0 +1,29 @@
+[DEFAULT]
+bind_host = {{ internal_ip }}
+bind_port = 8890
+auth_strategy = keystone
+policy_file = /usr/local/etc/tacker/policy.json
+debug = True
+verbose = True
+use_syslog = False
+state_path = /var/lib/tacker
+
+[keystone_authtoken]
+password = console
+auth_uri = http://{{ internal_vip.ip }}:5000
+auth_url = http://{{ internal_vip.ip }}:35357
+project_name = service
+
+[agent]
+root_helper = sudo /usr/local/bin/tacker-rootwrap /usr/local/etc/tacker/rootwrap.conf
+
+[DATABASE]
+connection = mysql://tacker:TACKER_DBPASS@{{ internal_vip.ip }}:3306/tacker?charset=utf8
+
+[servicevm_nova]
+password = console
+auth_url = http://{{ internal_vip.ip }}:35357
+
+[servicevm_heat]
+heat_uri = http://{{ internal_vip.ip }}:8004/v1
+
diff --git a/deploy/adapters/ansible/roles/tacker/vars/Debian.yml b/deploy/adapters/ansible/roles/tacker/vars/Debian.yml
new file mode 100755
index 00000000..59a4dbd9
--- /dev/null
+++ b/deploy/adapters/ansible/roles/tacker/vars/Debian.yml
@@ -0,0 +1,14 @@
+##############################################################################
+# 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
+##############################################################################
+---
+packages:
+ - software-properties-common
+ - crudini
+
+services: []
diff --git a/deploy/adapters/ansible/roles/tacker/vars/RedHat.yml b/deploy/adapters/ansible/roles/tacker/vars/RedHat.yml
new file mode 100755
index 00000000..59a4dbd9
--- /dev/null
+++ b/deploy/adapters/ansible/roles/tacker/vars/RedHat.yml
@@ -0,0 +1,14 @@
+##############################################################################
+# 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
+##############################################################################
+---
+packages:
+ - software-properties-common
+ - crudini
+
+services: []
diff --git a/deploy/adapters/ansible/roles/tacker/vars/main.yml b/deploy/adapters/ansible/roles/tacker/vars/main.yml
new file mode 100755
index 00000000..2df4ca3a
--- /dev/null
+++ b/deploy/adapters/ansible/roles/tacker/vars/main.yml
@@ -0,0 +1,19 @@
+##############################################################################
+# 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
+##############################################################################
+tacker_pkg_name: tacker-2014.2.0.dev206.tar.gz
+tacker_client_pkg_name: python-tackerclient-0.0.1.dev85.tar.gz
+tacker_horizon_pkg_name: tacker-horizon-0.0.1.dev687.tar.gz
+tacker_home: /opt/tacker/
+tacker_client_home: /opt/tacker_client/
+tacker_horizon_home: /opt/tacker_horizon/
+
+tacker_configs_templates:
+ - src: tacker.j2
+ dest:
+ - /usr/local/etc/tacker/tacker.conf