diff options
author | chenshuai@huawei.com <chenshuai@huawei.com> | 2016-01-16 05:14:13 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-01-16 05:14:13 +0000 |
commit | 717887c33a1abdb47bf4cf1e927c7a8b02fd63bd (patch) | |
tree | e40286787fe418be7deb054de14fb04ae7b55940 /deploy/adapters/ansible/roles | |
parent | 7a1ca84a19fd1e5b8178ac3c471a30f71e845596 (diff) | |
parent | 6b168a9b8c44c141f71c2eab7e51973f3523f912 (diff) |
Merge "bugfix: workaround for opencontrail"
Diffstat (limited to 'deploy/adapters/ansible/roles')
12 files changed, 86 insertions, 60 deletions
diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml index 4e914749..4f21d50a 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml @@ -8,15 +8,15 @@ dest: "/etc/network/interfaces" line: "{{ item }}" with_items: - - "auto {{ contrail_device }}" - - "iface {{ contrail_device }} inet static" - - "\taddress {{ contrail_address }}" - - "\tnetmask {{ contrail_netmask }}" + - "auto {{ contrail_vhost_device }}" + - "iface {{ contrail_vhost_device }} inet static" + - "\taddress {{ contrail_vhost_address }}" + - "\tnetmask {{ contrail_vhost_netmask }}" - name: "set interface address" # sudo: True - shell: "ifconfig {{ contrail_device }} {{ contrail_address }} netmask {{ contrail_netmask }}" + shell: "ifconfig {{ contrail_vhost_device }} {{ contrail_vhost_address }} netmask {{ contrail_vhost_netmask }}" - name: "up interface" # sudo: True - shell: "ifconfig {{ contrail_device }} up" + shell: "ifconfig {{ contrail_vhost_device }} up" diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml index e3e1b3e5..d2c69600 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml @@ -37,10 +37,9 @@ # or inventory_hostname in groups['opencontrail_tsn'] -# Compass adapter: use OpenStack management network "mgmt" -#- name: Install interface on all hosts for Open Contrail -# include: install/install-interface.yml -# when: groups['opencontrail_control']|length !=0 +- name: Install interface on all hosts for Open Contrail + include: install/install-interface.yml + when: groups['opencontrail_control']|length !=0 #- include: install/install-common.yml #- include: install/install-kernel.yml diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml index b8c07ddd..a9f34ed6 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-add-nodes.yml @@ -2,6 +2,15 @@ #- hosts: config # sudo: yes # tasks: + +- name: "recover rabbitmq-server service script" + shell: if [ ! -f "\/etc\/init.d\/rabbitmq-server.initd.supervisord" ] ; then mv /etc/init.d/rabbitmq-server.initd.supervisord /home/rabbitmq-server.initd.supervisord; mv /etc/init.d/rabbitmq-server /home/rabbit-server; mv /etc/init.d/rabbitmq-server.backup /etc/init.d/rabbitmq-server; fi + +- name: "restart rabbitmq-server" + service: + name: "rabbitmq-server" + state: "restarted" + - name: "provision config node" shell: "python /opt/contrail/utils/provision_config_node.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --oper add --host_name {{ ansible_hostname }} --host_ip {{ contrail_address }}" when: inventory_hostname in groups['opencontrail_config'] diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml index 495ba6b2..4fbff0b7 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml @@ -38,7 +38,7 @@ - name: "set contrail device name for ansible" set_fact: - contrail_ansible_device: "ansible_{{ contrail_device }}" + contrail_ansible_device: "ansible_{{ contrail_vhost_device }}" - name: "fix up default pmac" template: @@ -52,7 +52,7 @@ lineinfile: dest: "/etc/contrail/agent_param" regexp: "dev=__DEVICE__" - line: "dev={{ contrail_device }}" + line: "dev={{ contrail_vhost_device }}" - name: "fix up contrail vrouter agent config" template: @@ -62,9 +62,9 @@ - name: "delete lines for contrail interface" shell: "{{ item }}" with_items: - - "sed -e '/auto {{ contrail_device }}/,$d' /etc/network/interfaces > /tmp/contrail-interfaces-top" - - "sed -n -e '/auto {{ contrail_device }}/,$p' /etc/network/interfaces > /tmp/contrail-interfaces-bottom" - - "sed -i -e '/auto {{ contrail_device }}/d' /tmp/contrail-interfaces-bottom" + - "sed -e '/auto {{ contrail_vhost_device }}/,$d' /etc/network/interfaces > /tmp/contrail-interfaces-top" + - "sed -n -e '/auto {{ contrail_vhost_device }}/,$p' /etc/network/interfaces > /tmp/contrail-interfaces-bottom" + - "sed -i -e '/auto {{ contrail_vhost_device }}/d' /tmp/contrail-interfaces-bottom" - "sed -i -n -e '/auto .*/,$p' /tmp/contrail-interfaces-bottom" - "cat /tmp/contrail-interfaces-top /tmp/contrail-interfaces-bottom > /etc/network/interfaces" @@ -77,22 +77,28 @@ - "sed -i -n -e '/auto .*/,$p' /tmp/contrail-interfaces-bottom" - "cat /tmp/contrail-interfaces-top /tmp/contrail-interfaces-bottom > /etc/network/interfaces" -#- name: "configure interface" -# lineinfile: -# dest: "/etc/network/interfaces" -# line: "{{ item }}" -# state: "present" -# with_items: -# - "auto {{ contrail_device }}" -# - "iface {{ contrail_device }} inet manual" -# - "\tpre-up ifconfig {{ contrail_device }} up" -# - "\tpost-down ifconfig {{ contrail_device }} down" -# - "auto vhost0" -# - "iface vhost0 inet static" -# - "\tpre-up /opt/contrail/bin/if-vhost0" -# - "\tnetwork_name application" -# - "\taddress {{ contrail_address }}" -# - "\tnetmask {{ contrail_netmask }}" +- name: "configure interface" + lineinfile: + dest: "/etc/network/interfaces" + line: "{{ item }}" + state: "present" + with_items: + - "auto {{ contrail_vhost_device }}" + - "iface {{ contrail_vhost_device }} inet manual" + - "\tpre-up ifconfig {{ contrail_vhost_device }} up" + - "\tpost-down ifconfig {{ contrail_vhost_device }} down" + - "auto vhost0" + - "iface vhost0 inet static" + - "\tpre-up /opt/contrail/bin/if-vhost0" + - "\tnetwork_name application" + - "\taddress {{ contrail_vhost_address }}" + - "\tnetmask {{ contrail_vhost_netmask }}" + +- name: "load vrouter driver" + command: su -s /bin/sh -c "insmod /var/lib/dkms/vrouter/2.21/build/vrouter.ko" + +- name: "run vhost0 script" + command: su -s /bin/sh -c "/opt/contrail/bin/if-vhost0" - name: "delete temporary files" file: @@ -164,9 +170,9 @@ name: "nova-compute" state: "restarted" -#- name: "add vrouter to contrail" -# shell: "python /opt/contrail/utils/provision_vrouter.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --openstack_ip {{ contrail_keystone_address }} --oper add --host_name {{ ansible_hostname }} --host_ip {{ contrail_address }}" -# +- name: "add vrouter to contrail" + shell: "python /opt/contrail/utils/provision_vrouter.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --admin_tenant_name admin --openstack_ip {{ contrail_keystone_address }} --oper add --host_name {{ ansible_hostname }} --host_ip {{ contrail_address }}" + #- name: "reboot Server" # shell: "shutdown -r now" # async: 0 diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-tsn.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-tsn.yml index 33ad6507..7c46f11a 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-tsn.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-tsn.yml @@ -17,7 +17,7 @@ - name: "set contrail device name for ansible" set_fact: - contrail_ansible_device: "ansible_{{ contrail_device }}" + contrail_ansible_device: "ansible_{{ contrail_vhost_device }}" - name: "fix up default pmac" template: @@ -31,7 +31,7 @@ lineinfile: dest: "/etc/contrail/agent_param" regexp: "dev=__DEVICE__" - line: "dev={{ contrail_device }}" + line: "dev={{ contrail_vhost_device }}" - name: "set vrouter agent mode" set_fact: @@ -45,9 +45,9 @@ - name: "delete lines for contrail interface" shell: "{{ item }}" with_items: - - "sed -e '/auto {{ contrail_device }}/,$d' /etc/network/interfaces > /tmp/contrail-interfaces-top" - - "sed -n -e '/auto {{ contrail_device }}/,$p' /etc/network/interfaces > /tmp/contrail-interfaces-bottom" - - "sed -i -e '/auto {{ contrail_device }}/d' /tmp/contrail-interfaces-bottom" + - "sed -e '/auto {{ contrail_vhost_device }}/,$d' /etc/network/interfaces > /tmp/contrail-interfaces-top" + - "sed -n -e '/auto {{ contrail_vhost_device }}/,$p' /etc/network/interfaces > /tmp/contrail-interfaces-bottom" + - "sed -i -e '/auto {{ contrail_vhost_device }}/d' /tmp/contrail-interfaces-bottom" - "sed -i -n -e '/auto .*/,$p' /tmp/contrail-interfaces-bottom" - "cat /tmp/contrail-interfaces-top /tmp/contrail-interfaces-bottom > /etc/network/interfaces" @@ -66,16 +66,16 @@ line: "{{ item }}" state: "present" with_items: - - "auto {{ contrail_device }}" - - "iface {{ contrail_device }} inet manual" - - "\tpre-up ifconfig {{ contrail_device }} up" - - "\tpost-down ifconfig {{ contrail_device }} down" + - "auto {{ contrail_vhost_device }}" + - "iface {{ contrail_vhost_device }} inet manual" + - "\tpre-up ifconfig {{ contrail_vhost_device }} up" + - "\tpost-down ifconfig {{ contrail_vhost_device }} down" - "auto vhost0" - "iface vhost0 inet static" - "\tpre-up /opt/contrail/bin/if-vhost0" - "\tnetwork_name application" - - "\taddress {{ contrail_address }}" - - "\tnetmask {{ contrail_netmask }}" + - "\taddress {{ contrail_vhost_address }}" + - "\tnetmask {{ contrail_vhost_netmask }}" - name: "delete temporary files" file: diff --git a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-analytics-api-conf.j2 b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-analytics-api-conf.j2 index 6e2bcce3..3ac84c33 100755 --- a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-analytics-api-conf.j2 +++ b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-analytics-api-conf.j2 @@ -1,12 +1,12 @@ [DEFAULTS] host_ip = {{ contrail_address }} rest_api_ip = {{ contrail_haproxy_address }} -rest_api_port = 9081 +rest_api_port = 8081 #cassandra_server_list = {% for cur_host in groups['opencontrail_database'] %}{{ ip_settings[cur_host]['mgmt']['ip'] }}:9160{% if not loop.last %} {% endif %}{% endfor %} #chenshuai: This kind of written is also correct, but the following is better, this as record cassandra_server_list = {% for cur_host in groups['opencontrail_database'] %}{{ haproxy_hosts[cur_host] }}:9160{% if not loop.last %} {% endif %}{% endfor %} -collectors = {{ contrail_address }}:8086 +collectors = {{ contrail_haproxy_address }}:8086 http_server_port = 8090 log_file = /var/log/contrail/contrail-analytics-api.log log_level = SYS_NOTICE diff --git a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-api-supervisord-conf.j2 b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-api-supervisord-conf.j2 index 94da3d71..ad3e0387 100755 --- a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-api-supervisord-conf.j2 +++ b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-api-supervisord-conf.j2 @@ -1,5 +1,5 @@ [program:contrail-api] -command=/usr/bin/contrail-api --conf_file /etc/contrail/contrail-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf --listen_port 910%(process_num)01d --worker_id %(process_num)s +command=/usr/bin/contrail-api --conf_file /etc/contrail/contrail-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf --worker_id %(process_num)s numprocs=1 process_name=%(process_num)s redirect_stderr=true diff --git a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-discovery-supervisord-conf.j2 b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-discovery-supervisord-conf.j2 index 5f0a698d..541568de 100755 --- a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-discovery-supervisord-conf.j2 +++ b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-discovery-supervisord-conf.j2 @@ -1,5 +1,5 @@ [program:contrail-discovery] -command=/usr/bin/contrail-discovery --conf_file /etc/contrail/contrail-discovery.conf --listen_port 911%(process_num)01d --worker_id %(process_num)s +command=/usr/bin/contrail-discovery --conf_file /etc/contrail/contrail-discovery.conf --worker_id %(process_num)s numprocs=1 process_name=%(process_num)s redirect_stderr=true diff --git a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-schema-conf.j2 b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-schema-conf.j2 index cf5dead3..46995f75 100755 --- a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-schema-conf.j2 +++ b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-schema-conf.j2 @@ -1,11 +1,11 @@ [DEFAULTS] #ifmap_server_ip = {{ ip_settings[haproxy_hosts.keys()[0]]['mgmt']['ip'] }} -ifmap_server_ip = {{ haproxy_hosts.values()[0] }} +ifmap_server_ip = {{ contrail_haproxy_address }} ifmap_server_port = 8443 ifmap_username = schema-transformer ifmap_password = schema-transformer #api_server_ip = {{ ip_settings[haproxy_hosts.keys()[0]]['mgmt']['ip'] }} -api_server_ip = {{ haproxy_hosts.values()[0] }} +api_server_ip = {{ contrail_haproxy_address }} api_server_port = 8082 zk_server_ip = {% for cur_host in groups['opencontrail_database'] %}{{ haproxy_hosts[cur_host] }}:2181{% if not loop.last %}, {% endif %}{% endfor %} diff --git a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-vrouter-agent-conf.j2 b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-vrouter-agent-conf.j2 index 207509e5..78b31775 100755 --- a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-vrouter-agent-conf.j2 +++ b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-vrouter-agent-conf.j2 @@ -66,7 +66,7 @@ platform = default physical_interface_address = # MAC address of device used by dpdk -physical_interface_mac = {{ hostvars[inventory_hostname][contrail_ansible_device]['macaddress'] }} +physical_interface_mac = {{ hostvars[inventory_hostname][contrail_device]['macaddress'] }} [DISCOVERY] # If COLLECTOR and/or CONTROL-NODE and/or DNS is not specified this section is @@ -118,7 +118,7 @@ vmware_physical_interface = [NETWORKS] # control-channel IP address used by WEB-UI to connect to vnswad to fetch # required information (Optional) -control_network_ip = {{ contrail_address }} +control_network_ip = {{ contrail_haproxy_address }} [VIRTUAL-HOST-INTERFACE] # Everything in this section is mandatory @@ -127,10 +127,10 @@ control_network_ip = {{ contrail_address }} name = vhost0 # IP address and prefix in ip/prefix_len format -ip = {{ contrail_address }}/{{ contrail_prefixlen }} +ip = {{ contraili_vhost_address }}/{{ contrail_prefixlen }} # Gateway IP address for virtual host -gateway = {{ contrail_gateway }} +gateway = {{ contrail_vhost_gateway }} # Physical interface name to which virtual host interface maps to physical_interface = {{ contrail_device }} diff --git a/deploy/adapters/ansible/roles/open-contrail/templates/provision/haproxy-contrail-cfg.j2 b/deploy/adapters/ansible/roles/open-contrail/templates/provision/haproxy-contrail-cfg.j2 index 435a4f5c..01196369 100755 --- a/deploy/adapters/ansible/roles/open-contrail/templates/provision/haproxy-contrail-cfg.j2 +++ b/deploy/adapters/ansible/roles/open-contrail/templates/provision/haproxy-contrail-cfg.j2 @@ -29,7 +29,7 @@ listen contrail-api timeout client 3m timeout server 3m {% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:9100 weight 1 check inter 2000 rise 2 fall 3 + server {{ host }} {{ ip }}:8082 weight 1 check inter 2000 rise 2 fall 3 {% endfor %} @@ -41,7 +41,7 @@ listen contrail-discovery balance roundrobin option nolinger {% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:9110 weight 1 check inter 2000 rise 2 fall 3 + server {{ host }} {{ ip }}:5998 weight 1 check inter 2000 rise 2 fall 3 {% endfor %} @@ -56,7 +56,7 @@ listen contrail-analytics-api tcp-check connect port 6379 default-server error-limit 1 on-error mark-down {% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:9081 weight 1 check inter 2000 rise 2 fall 5 + server {{ host }} {{ ip }}:8081 weight 1 check inter 2000 rise 2 fall 5 {% endfor %} diff --git a/deploy/adapters/ansible/roles/open-contrail/vars/main.yml b/deploy/adapters/ansible/roles/open-contrail/vars/main.yml index 4c8b73a7..c281f5a5 100755 --- a/deploy/adapters/ansible/roles/open-contrail/vars/main.yml +++ b/deploy/adapters/ansible/roles/open-contrail/vars/main.yml @@ -10,8 +10,8 @@ contrail_admin_password: "console" # network infor adapter for compass -contrail_device: "mgmt" contrail_address: "{{ internal_ip }}" +#contrail_device: # compass openstack device contrail_netmask: "255.255.255.0" #contrail_gateway: "10.84.50.254" contrail_gateway: @@ -19,6 +19,19 @@ contrail_gateway: +########################################################### +### we make an independent NIC for OpenContrail vRouter ### +########################################################### +contrail_vhost_device: "eth2" +contrail_vhost_address: +contrail_vhost_gateway: +########################################################### +########################################################### +########################################################### + + + + contrail_keepalived: no #contrail_haproxy_address: "10.0.0.22" # 10.0.0.80 contrail_haproxy_address: "{{ internal_vip.ip }}" @@ -60,7 +73,6 @@ kernel_package_noarch: [] compute_package_noarch: [] # network infor adapter for compass -contrail_device: "mgmt" contrail_address: "{{ internal_ip }}" contrail_netmask: "255.255.255.0" #contrail_gateway: "10.84.50.254" |