diff options
13 files changed, 253 insertions, 6 deletions
diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/heat/tasks/heat_install.yml b/deploy/adapters/ansible/openstack_mitaka/roles/heat/tasks/heat_install.yml new file mode 100644 index 00000000..b90e6402 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/heat/tasks/heat_install.yml @@ -0,0 +1,39 @@ +############################################################################## +# 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 heat related packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: packages | union(packages_noarch) + +- name: generate heat service list + lineinfile: dest=/opt/service create=yes line='{{ item }}' + with_items: services | union(services_noarch) + +# ' + +- name: create heat user domain + shell: > + . /opt/admin-openrc-v3.sh; + openstack domain create --description "Stack projects and users" heat; + openstack user create --domain heat --password {{ HEAT_PASS }} heat_domain_admin; + openstack role add --domain heat --user-domain heat --user heat_domain_admin admin; + openstack role create heat_stack_owner; + openstack role add --project demo --user demo heat_stack_owner; + when: inventory_hostname == groups['controller'][0] + +- name: update heat conf + template: src=heat.j2 + dest=/etc/heat/heat.conf + backup=yes + notify: + - restart heat service + - remove heat-sqlite-db + diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/heat/templates/heat.j2 b/deploy/adapters/ansible/openstack_mitaka/roles/heat/templates/heat.j2 new file mode 100644 index 00000000..62df9fd9 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/heat/templates/heat.j2 @@ -0,0 +1,28 @@ +[DEFAULT] +heat_metadata_server_url = http://{{ internal_vip.ip }}:8000 +heat_waitcondition_server_url = http://{{ internal_vip.ip }}:8000/v1/waitcondition +rpc_backend = rabbit +rabbit_host = {{ rabbit_host }} +rabbit_userid = {{ RABBIT_USER }} +rabbit_password = {{ RABBIT_PASS }} +log_dir = /var/log/heat +stack_domain_admin = heat_domain_admin +stack_domain_admin_password = {{ HEAT_PASS }} +stack_user_domain_name = heat + +[database] +connection = mysql://heat:{{ HEAT_DBPASS }}@{{ db_host }}/heat +idle_timeout = 30 +use_db_reconnect = True +pool_timeout = 10 + +[ec2authtoken] +auth_uri = http://{{ internal_vip.ip }}:5000/v2.0 + +[keystone_authtoken] +auth_uri = http://{{ internal_vip.ip }}:5000/v2.0 +identity_uri = http://{{ internal_vip.ip }}:35357 +admin_tenant_name = service +admin_user = heat +admin_password = {{ HEAT_PASS }} + diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/keystone/tasks/keystone_install.yml b/deploy/adapters/ansible/openstack_mitaka/roles/keystone/tasks/keystone_install.yml new file mode 100644 index 00000000..ea6926f4 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/keystone/tasks/keystone_install.yml @@ -0,0 +1,88 @@ +############################################################################## +# 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: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + +- name: install keystone packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: packages | union(packages_noarch) + +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + +- name: generate keystone service list + lineinfile: dest=/opt/service create=yes line='{{ item }}' + with_items: services | union(services_noarch) + +- name: delete sqlite database + file: + path: /var/lib/keystone/keystone.db + state: absent + +- name: update keystone conf + template: src=keystone.conf dest=/etc/keystone/keystone.conf backup=yes + notify: + - restart keystone services + +- name: assure listen port exist + lineinfile: + dest: '{{ apache_config_dir }}/ports.conf' + regexp: '{{ item.regexp }}' + line: '{{ item.line}}' + with_items: + - regexp: "^Listen {{ internal_ip }}:5000" + line: "Listen {{ internal_ip }}:5000" + - regexp: "^Listen {{ internal_ip }}:35357" + line: "Listen {{ internal_ip }}:35357" + notify: + - restart keystone services + +- name: update apache2 configs + template: + src: wsgi-keystone.conf.j2 + dest: '{{ apache_config_dir }}/sites-available/wsgi-keystone.conf' + when: ansible_os_family == 'Debian' + notify: + - restart keystone services + +- name: update apache2 configs + template: + src: wsgi-keystone.conf.j2 + dest: '{{ apache_config_dir }}/wsgi-keystone.conf' + when: ansible_os_family == 'RedHat' + notify: + - restart keystone services + +- name: enable keystone server + file: + src: "{{ apache_config_dir }}/sites-available/wsgi-keystone.conf" + dest: "{{ apache_config_dir }}/sites-enabled/wsgi-keystone.conf" + state: "link" + when: ansible_os_family == 'Debian' + notify: + - restart keystone services + +- name: keystone source files + template: src={{ item }} dest=/opt/{{ item }} + with_items: + - admin-openrc.sh + - demo-openrc.sh + - admin-openrc-v3.sh + +- meta: flush_handlers diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/keystone/templates/admin-openrc-v3.sh b/deploy/adapters/ansible/openstack_mitaka/roles/keystone/templates/admin-openrc-v3.sh new file mode 100644 index 00000000..c3d863e8 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/keystone/templates/admin-openrc-v3.sh @@ -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 +############################################################################## +# Verify the Identity Service installation +export OS_PASSWORD={{ ADMIN_PASS }} +export OS_TENANT_NAME=admin +export OS_AUTH_URL=http://{{ internal_vip.ip }}:35357/v3 +export OS_IDENTITY_API_VERSION=3 +export OS_USERNAME=admin +export OS_VOLUME_API_VERSION=2 +export OS_USER_DOMAIN_NAME=Default +export OS_PROJECT_DOMAIN_NAME=Default + + diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/keystone/vars/Debian.yml b/deploy/adapters/ansible/openstack_mitaka/roles/keystone/vars/Debian.yml new file mode 100644 index 00000000..b8d8e7c2 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/keystone/vars/Debian.yml @@ -0,0 +1,21 @@ +############################################################################## +# 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 +############################################################################## +--- + +cron_path: "/var/spool/cron/crontabs" + +packages: + - keystone + - python-openstackclient + +services: + - apache2 + +apache_config_dir: /etc/apache2 +http_service_name: apache2 diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/keystone/vars/RedHat.yml b/deploy/adapters/ansible/openstack_mitaka/roles/keystone/vars/RedHat.yml new file mode 100644 index 00000000..63ddce3c --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/keystone/vars/RedHat.yml @@ -0,0 +1,20 @@ +############################################################################## +# 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 +############################################################################## +--- +cron_path: "/var/spool/cron" + +packages: + - openstack-keystone + - python-openstackclient + +services: + - httpd + +apache_config_dir: /etc/httpd/conf.d +http_service_name: httpd diff --git a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/odl_cluster/files/opendaylight.service b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/odl_cluster/files/opendaylight.service index eea02211..6c9e4c44 100644 --- a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/odl_cluster/files/opendaylight.service +++ b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/odl_cluster/files/opendaylight.service @@ -7,6 +7,7 @@ After= User=root Group=root Type=simple +EnvironmentFile=-/opt/moon-environment WorkingDirectory=/opt/opendaylight-0.3.0 PermissionsStartOnly=true ExecStartPre= diff --git a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/odl_cluster/tasks/moon-odl.yml b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/odl_cluster/tasks/moon-odl.yml index a2ad56c2..25306059 100644 --- a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/odl_cluster/tasks/moon-odl.yml +++ b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/odl_cluster/tasks/moon-odl.yml @@ -19,7 +19,7 @@ shell: rm -rf {{ odl_home }}/system/org/opendaylight/aaa/ - name: download apache maven package file - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/odl/apache-maven-3.3.9-bin.tar.gz" dest=/opt/apache-maven-3.3.9-bin.tar.gz + get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/moon/apache-maven-3.3.9-bin.tar.gz" dest=/opt/apache-maven-3.3.9-bin.tar.gz - name: create maven folder shell: mkdir -p /opt/apache-maven-3.3.9/ @@ -52,7 +52,4 @@ shell: rm -f {{ odl_home }}/etc/shiro.ini - name: set moon env - shell: > - export MOON_SERVER_ADDR={{ internal_vip.ip }}; - export MOON_SERVER_PORT=5000; - export no_proxy="localhost,127.0.0.1"; + template: src=moon-environment dest=/opt/moon-environment diff --git a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/odl_cluster/templates/moon-environment b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/odl_cluster/templates/moon-environment new file mode 100644 index 00000000..9a13da8e --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/odl_cluster/templates/moon-environment @@ -0,0 +1,3 @@ +MOON_SERVER_ADDR={{ internal_vip.ip }} +MOON_SERVER_PORT=5000 +no_proxy="localhost,127.0.0.1" diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml index 441ec2e2..a917a769 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml @@ -19,3 +19,6 @@ include: openvswitch.yml when: groups['odl']|length !=0 and inventory_hostname not in groups['odl'] +- name: Config nova + include: odl_l3_nova.yml + when: groups['odl']|length !=0 and odl_l3_agent == "Enable" diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml index 5c9b203e..51093236 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml @@ -187,6 +187,19 @@ service: name=keepalived state=stopped when: ansible_os_family == "Debian" +################ l3 agent remove ################### +- name: turn off neutron-l3-agent on control node + service: name=neutron-l3-agent state=stopped + when: odl_l3_agent == "Enable" + +- name: remove neutron-l3-agent daemon + shell: > + sed -i 'neutron-l3-agent/d' /opt/service ; + mv /etc/init.d/neutron-l3-agent /home/ ; + mv /etc/init/neutron-l3-agent.conf /home/ ; + when: odl_l3_agent == "Enable" +#################################################### + - name: chown opendaylight directory and files shell: > chown -R odl:odl "{{ odl_home }}"; diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_l3_nova.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_l3_nova.yml new file mode 100644 index 00000000..4e53f4aa --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_l3_nova.yml @@ -0,0 +1,15 @@ +############################################################################## +# 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: set file inject in nova.conf + shell: crudini --set /etc/nova/nova.conf DEFAULT force_config_drive true + +- name: restart all nova service + shell: for i in `cat /opt/service | grep nova` ; do service $i restart; done diff --git a/deploy/adapters/ansible/roles/odl_cluster_neutron/tasks/main.yml b/deploy/adapters/ansible/roles/odl_cluster_neutron/tasks/main.yml index 751a02d7..3024dcf1 100755 --- a/deploy/adapters/ansible/roles/odl_cluster_neutron/tasks/main.yml +++ b/deploy/adapters/ansible/roles/odl_cluster_neutron/tasks/main.yml @@ -11,7 +11,7 @@ - name: restart neutron-l3-agent server service: name=neutron-l3-agent state=restarted - when: inventory_hostname in groups['odl'] + when: inventory_hostname in groups['odl'] and odl_l3_agent == "Disable" - name: restart neutron-dhcp-agent server service: name=neutron-dhcp-agent state=restarted |