diff options
author | baigk <baiguoku@huawei.com> | 2015-08-06 02:37:33 -0400 |
---|---|---|
committer | baigk <baiguoku@huawei.com> | 2015-08-09 22:47:56 -0400 |
commit | 87612abc0e24cafd89a49e350165b08fe1608233 (patch) | |
tree | 07b156c0268fd189f92e8a0730118edc51b8073f /deploy/adapters/ansible/roles/neutron-network | |
parent | 5aedf594112c0749b6e9039d15b9fe70d210a942 (diff) |
support deployment openstack juno with ansible for compass in centos7.1
JIRA: COMPASS-6
Change-Id: I8ef865e8acfe29c3ff5c7e9030e4cebabed3457b
Signed-off-by: baigk <baiguoku@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/neutron-network')
8 files changed, 90 insertions, 62 deletions
diff --git a/deploy/adapters/ansible/roles/neutron-network/files/xorp b/deploy/adapters/ansible/roles/neutron-network/files/xorp new file mode 100644 index 00000000..5a486107 --- /dev/null +++ b/deploy/adapters/ansible/roles/neutron-network/files/xorp @@ -0,0 +1,23 @@ +# Defaults for xorp initscript +# sourced by /etc/init.d/xorp +# installed at /etc/default/xorp by the maintainer scripts + +# +# This is a POSIX shell fragment +# + +# Master system-wide xorp switch. The initscript +# will not run if it is not set to yes. + +RUN="yes" + + +# Additional options that are passed to the rtrmgr Daemon. +# e.g. : +# -a <allowed host> Host allowed by the finder +# -n <allowed net> Subnet allowed by the finder +# -v Print verbose information +# -b <file> Specify boot file +# -d Run as a daemon, detach from tty + +DAEMON_OPTS="-b /etc/xorp/config.boot " diff --git a/deploy/adapters/ansible/roles/neutron-network/handlers/main.yml b/deploy/adapters/ansible/roles/neutron-network/handlers/main.yml index d6c5cc8f..7e67b76e 100644 --- a/deploy/adapters/ansible/roles/neutron-network/handlers/main.yml +++ b/deploy/adapters/ansible/roles/neutron-network/handlers/main.yml @@ -1,21 +1,19 @@ --- -- name: restart neutron-plugin-openvswitch-agent - service: name=neutron-plugin-openvswitch-agent state=restarted enabled=yes - when: "'opendaylight' not in {{ NEUTRON_MECHANISM_DRIVERS }}" +- name: restart common neutron network relation service + service: name={{ item }} state=restarted enabled=yes + with_items: services_noarch -- name: restart neutron-l3-agent - service: name=neutron-l3-agent state=restarted enabled=yes +- name: restart neutron network relation service + service: name={{ item }} state=restarted enabled=yes + with_items: services + +- name: restart openvswitch agent service + service: name=neutron-openvswitch-agent state=restarted enabled=yes - name: kill dnsmasq command: killall dnsmasq ignore_errors: True -- name: restart neutron-dhcp-agent - service: name=neutron-dhcp-agent state=restarted enabled=yes - -- name: restart neutron-metadata-agent - service: name=neutron-metadata-agent state=restarted enabled=yes - - name: restart xorp service: name=xorp state=restarted enabled=yes sleep=10 ignore_errors: True diff --git a/deploy/adapters/ansible/roles/neutron-network/tasks/igmp-router.yml b/deploy/adapters/ansible/roles/neutron-network/tasks/igmp-router.yml index d6f38a0e..c9406ca3 100644 --- a/deploy/adapters/ansible/roles/neutron-network/tasks/igmp-router.yml +++ b/deploy/adapters/ansible/roles/neutron-network/tasks/igmp-router.yml @@ -1,6 +1,10 @@ --- - name: Install XORP to provide IGMP router functionality - apt: pkg=xorp + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: xorp_packages + +- name: create xorp directory + file: path=/etc/xorp state=directory - name: configure xorp template: src=etc/xorp/config.boot dest=/etc/xorp/config.boot @@ -8,7 +12,7 @@ - restart xorp - name: set xorp defaults - lineinfile: dest=/etc/default/xorp regexp=^RUN= line=RUN=yes + copy: src=xorp dest=/etc/default/xorp notify: - restart xorp diff --git a/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml b/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml index f0953e0e..758f3208 100644 --- a/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml +++ b/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml @@ -14,65 +14,47 @@ value=0 state=present reload=yes - name: install neutron network related packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" - with_items: packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: packages | union(packages_noarch) -- name: install neutron openvswitch agent - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" - with_items: neutron_plugin_openvswitch_agent_packages - when: "'openvswitch' in {{ NEUTRON_MECHANISM_DRIVERS }}" - -- name: generate neutron service list +- name: generate neutron network service list shell: echo {{ item }} >> /opt/service - with_items: services + with_items: services | union(services_noarch) -- name: generate neutron-plugin-openvswitch-agent service list - shell: echo {{ item }} >> /opt/service - with_items: neutron-plugin-openvswitch-agent-services - when: "'openvswitch' in {{ NEUTRON_MECHANISM_DRIVERS }}" - -- name: config neutron - template: src=neutron-network.conf - dest=/etc/neutron/neutron.conf backup=yes - notify: - - restart neutron-plugin-openvswitch-agent - - restart neutron-l3-agent - - kill dnsmasq - - restart neutron-dhcp-agent - - restart neutron-metadata-agent +- name: fix openstack neutron plugin config file + shell: | + sed -i 's,plugins/openvswitch/ovs_neutron_plugin.ini,plugin.ini,g' /usr/lib/systemd/system/neutron-openvswitch-agent.service + systemctl daemon-reload + when: ansible_os_family == 'RedHat' - name: config l3 agent template: src=l3_agent.ini dest=/etc/neutron/l3_agent.ini backup=yes - notify: - - restart neutron-l3-agent - name: config dhcp agent template: src=dhcp_agent.ini dest=/etc/neutron/dhcp_agent.ini backup=yes - notify: - - kill dnsmasq - - restart neutron-dhcp-agent - name: update dnsmasq-neutron.conf template: src=dnsmasq-neutron.conf dest=/etc/neutron/dnsmasq-neutron.conf - notify: - - kill dnsmasq - - restart neutron-dhcp-agent - name: config metadata agent template: src=metadata_agent.ini dest=/etc/neutron/metadata_agent.ini backup=yes - notify: - - restart neutron-metadata-agent - name: config ml2 plugin template: src=ml2_conf.ini dest=/etc/neutron/plugins/ml2/ml2_conf.ini backup=yes + +- name: config neutron + template: src=neutron-network.conf + dest=/etc/neutron/neutron.conf backup=yes notify: - - restart neutron-plugin-openvswitch-agent + - restart common neutron network relation service + - restart neutron network relation service + - kill dnsmasq - meta: flush_handlers @@ -83,13 +65,21 @@ openvswitch_bridge: bridge=br-ex state=present when: "'openvswitch' in {{ NEUTRON_MECHANISM_DRIVERS }}" +- name: ln plugin.ini + file: src=/etc/neutron/plugins/ml2/ml2_conf.ini dest=/etc/neutron/plugin.ini state=link + +- name: restart openvswitch-agent service + service: name={{ openvswitch_agent }} state=restarted enabled=yes + +- meta: flush_handlers + - name: assign a port to br-ex for physical ext interface openvswitch_port: bridge=br-ex port={{ INTERFACE_NAME }} state=present when: "'openvswitch' in {{ NEUTRON_MECHANISM_DRIVERS }}" - include: igmp-router.yml - when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES }}" + when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES }} and ansible_os_family == 'Debian'" - name: assert kernel support for vxlan command: modinfo -F version vxlan @@ -103,8 +93,3 @@ - include: odl.yml when: "'opendaylight' in {{ NEUTRON_MECHANISM_DRIVERS }}" - -- name: restart ovs service - service: name=openvswitch-switch state=restarted enabled=yes - -- meta: flush_handlers diff --git a/deploy/adapters/ansible/roles/neutron-network/templates/nova.conf b/deploy/adapters/ansible/roles/neutron-network/templates/nova.conf index 95870732..2b2bd9bb 100644 --- a/deploy/adapters/ansible/roles/neutron-network/templates/nova.conf +++ b/deploy/adapters/ansible/roles/neutron-network/templates/nova.conf @@ -3,7 +3,7 @@ dhcpbridge_flagfile=/etc/nova/nova.conf dhcpbridge=/usr/bin/nova-dhcpbridge logdir=/var/log/nova state_path=/var/lib/nova -lock_path=/var/lock/nova +lock_path=/var/lib/nova/tmp force_dhcp_release=True iscsi_helper=tgtadm libvirt_use_virtio_for_bridges=True diff --git a/deploy/adapters/ansible/roles/neutron-network/vars/Debian.yml b/deploy/adapters/ansible/roles/neutron-network/vars/Debian.yml index 0350c42b..ee511a2d 100644 --- a/deploy/adapters/ansible/roles/neutron-network/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/neutron-network/vars/Debian.yml @@ -5,16 +5,13 @@ packages: - openvswitch-switch - neutron-l3-agent - neutron-dhcp-agent + - neutron-plugin-openvswitch-agent services: - - neutron-plugin-ml2 - - openvswitch-datapath-dkms - openvswitch-switch - - neutron-l3-agent - - neutron-dhcp-agent - -neutron_plugin_openvswitch_agent_packages: - neutron-plugin-openvswitch-agent -neutron-plugin-openvswitch-agent-services: - - neutron-plugin-openvswitch-agent +openvswitch_agent: neutron-plugin-openvswitch-agent + +xorp_packages: + - xorp diff --git a/deploy/adapters/ansible/roles/neutron-network/vars/RedHat.yml b/deploy/adapters/ansible/roles/neutron-network/vars/RedHat.yml new file mode 100644 index 00000000..4be67bd1 --- /dev/null +++ b/deploy/adapters/ansible/roles/neutron-network/vars/RedHat.yml @@ -0,0 +1,14 @@ +--- +packages: + - openstack-neutron-ml2 + - openstack-neutron-openvswitch + +services: + - openvswitch + - neutron-openvswitch-agent + +openvswitch_agent: neutron-openvswitch-agent + +xorp_packages: + - openssl098e + - xorp diff --git a/deploy/adapters/ansible/roles/neutron-network/vars/main.yml b/deploy/adapters/ansible/roles/neutron-network/vars/main.yml new file mode 100644 index 00000000..77698b15 --- /dev/null +++ b/deploy/adapters/ansible/roles/neutron-network/vars/main.yml @@ -0,0 +1,7 @@ +--- +packages_noarch: [] + +services_noarch: + - neutron-l3-agent + - neutron-dhcp-agent + - neutron-metadata-agent |