Removed fuel from Genesis master since fuel has moved to repo fuel.
[genesis.git] / compass / deploy / ansible / roles / neutron-network / tasks / main.yml
1 ---
2 - name: activate ipv4 forwarding
3   sysctl: name=net.ipv4.ip_forward value=1
4           state=present reload=yes
5
6 - name: deactivate ipv4 rp filter
7   sysctl: name=net.ipv4.conf.all.rp_filter value=0
8           state=present reload=yes
9
10 - name: deactivate ipv4 default rp filter
11   sysctl: name=net.ipv4.conf.default.rp_filter
12           value=0 state=present reload=yes
13
14 - name: install neutron network related packages
15   apt: name={{ item }} state=present force=yes
16   with_items:
17     - neutron-plugin-ml2
18     - openvswitch-datapath-dkms
19     - openvswitch-switch
20     - neutron-l3-agent
21     - neutron-dhcp-agent
22
23 - name: generate neutron service list
24   shell: echo {{ item }} >> /opt/service
25   with_items:
26     - openvswitch-switch
27     - neutron-l3-agent
28     - neutron-dhcp-agent
29     - neutron-plugin-openvswitch-agent
30     - neutron-metadata-agent
31     - xorp
32
33 - name: install neutron openvswitch agent
34   apt: name=neutron-plugin-openvswitch-agent
35        state=present force=yes
36   when: "'openvswitch' in {{ NEUTRON_MECHANISM_DRIVERS }}"
37
38 - name: config neutron
39   template: src=neutron-network.conf
40             dest=/etc/neutron/neutron.conf backup=yes
41   notify:
42     - restart neutron-plugin-openvswitch-agent
43     - restart neutron-l3-agent
44     - kill dnsmasq
45     - restart neutron-dhcp-agent
46     - restart neutron-metadata-agent
47
48 - name: config l3 agent
49   template: src=l3_agent.ini dest=/etc/neutron/l3_agent.ini
50             backup=yes
51   notify:
52     - restart neutron-l3-agent
53
54 - name: config dhcp agent
55   template: src=dhcp_agent.ini dest=/etc/neutron/dhcp_agent.ini
56             backup=yes
57   notify:
58     - kill dnsmasq
59     - restart neutron-dhcp-agent
60
61 - name: update dnsmasq-neutron.conf
62   template: src=dnsmasq-neutron.conf
63             dest=/etc/neutron/dnsmasq-neutron.conf
64   notify:
65     - kill dnsmasq
66     - restart neutron-dhcp-agent
67
68 - name: config metadata agent
69   template: src=metadata_agent.ini
70             dest=/etc/neutron/metadata_agent.ini backup=yes
71   notify:
72     - restart neutron-metadata-agent
73
74 - name: config ml2 plugin
75   template: src=ml2_conf.ini
76             dest=/etc/neutron/plugins/ml2/ml2_conf.ini
77             backup=yes
78   notify:
79     - restart neutron-plugin-openvswitch-agent
80
81 - meta: flush_handlers
82
83 - name: add br-int
84   openvswitch_bridge: bridge=br-int state=present
85
86 - name: add br-ex
87   openvswitch_bridge: bridge=br-ex state=present 
88   when: "'openvswitch' in {{ NEUTRON_MECHANISM_DRIVERS }}"
89
90 - name: assign a port to br-ex for physical ext interface
91   openvswitch_port: bridge=br-ex port={{ INTERFACE_NAME }}
92                     state=present
93   when: "'openvswitch' in {{ NEUTRON_MECHANISM_DRIVERS }}"
94
95 - include: igmp-router.yml
96   when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES }}"
97
98 - name: assert kernel support for vxlan
99   command: modinfo -F version vxlan
100   when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES }}"
101
102 - name: assert iproute2 suppport for vxlan
103   command: ip link add type vxlan help
104   register: iproute_out
105   failed_when: iproute_out.rc == 255
106   when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES }}"
107
108 - include: odl.yml
109   when: "'opendaylight' in {{ NEUTRON_MECHANISM_DRIVERS }}"
110
111 - name: restart ovs service
112   service: name=openvswitch-switch state=restarted enabled=yes
113
114 - meta: flush_handlers