From e408668e84f138f69317ff63e68b823dfe80188b Mon Sep 17 00:00:00 2001 From: "chenshuai@huawei.com" Date: Tue, 8 Dec 2015 20:08:46 +0800 Subject: OpenContrail Script Adapter JIRA: COMPASS-186 Change-Id: I792bc1b592348c9bcc21d6e3616d7b0b79d13f25 Signed-off-by: chenshuai@huawei.com --- .../tasks/provision/provision-add-nodes.yml | 2 +- .../tasks/provision/provision-collector.yml | 8 ++--- .../tasks/provision/provision-compute.yml | 40 +++++++++++----------- .../tasks/provision/provision-config.yml | 35 ++++++++++--------- .../tasks/provision/provision-control.yml | 10 +++--- .../tasks/provision/provision-database.yml | 33 +++++++++++------- .../tasks/provision/provision-webui.yml | 6 ++-- 7 files changed, 74 insertions(+), 60 deletions(-) (limited to 'deploy/adapters/ansible/roles/open-contrail/tasks/provision') 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 f4ad05cb..b8c07ddd 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 @@ -44,4 +44,4 @@ shell: "python /opt/contrail/utils/provision_encap.py --api_server_ip {{ contrail_haproxy_address }} --admin_user {{ contrail_admin_user }} --admin_password {{ contrail_admin_password }} --oper add --encap_priority MPLSoUDP,MPLSoGRE,VXLAN" run_once: yes when: inventory_hostname in groups['opencontrail_config'] - \ No newline at end of file + diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-collector.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-collector.yml index 5dd72d77..4077ba64 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-collector.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-collector.yml @@ -19,19 +19,19 @@ - name: "fix up contrail collector config" template: - src: "provision/contrail-collector-conf.j2" + src: "../../templates/provision/contrail-collector-conf.j2" dest: "/etc/contrail/contrail-collector.conf" - name: "fix up contrail query engine config" template: - src: "provision/contrail-query-engine-conf.j2" + src: "../../templates/provision/contrail-query-engine-conf.j2" dest: "/etc/contrail/contrail-query-engine.conf" - name: "fix up contrail analytics api config" template: - src: "provision/contrail-analytics-api-conf.j2" + src: "../../templates/provision/contrail-analytics-api-conf.j2" dest: "/etc/contrail/contrail-analytics-api.conf" @@ -45,7 +45,7 @@ - name: "fix up contrail keystone auth config" template: - src: "provision/contrail-keystone-auth-conf.j2" + src: "../../templates/provision/contrail-keystone-auth-conf.j2" dest: "/etc/contrail/contrail-keystone-auth.conf" force: no 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 41ea5c25..3e3d6622 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 @@ -17,7 +17,7 @@ - name: "create cgroup device acl for qemu conf" template: - src: "provision/qemu-device-acl-conf.j2" + src: "../../templates/provision/qemu-device-acl-conf.j2" dest: "/tmp/qemu-device-acl.conf" when: deviceacl | failed @@ -33,7 +33,7 @@ - name: "fix up vrouter nodemgr param" template: - src: "provision/vrouter-nodemgr-param.j2" + src: "../../templates/provision/vrouter-nodemgr-param.j2" dest: "/etc/contrail/vrouter_nodemgr_param" - name: "set contrail device name for ansible" @@ -42,7 +42,7 @@ - name: "fix up default pmac" template: - src: "provision/default-pmac.j2" + src: "../../templates/provision/default-pmac.j2" dest: "/etc/contrail/default_pmac" - name: "copy agent param config from template" @@ -56,7 +56,7 @@ - name: "fix up contrail vrouter agent config" template: - src: "provision/contrail-vrouter-agent-conf.j2" + src: "../../templates/provision/contrail-vrouter-agent-conf.j2" dest: "/etc/contrail/contrail-vrouter-agent.conf" - name: "delete lines for contrail interface" @@ -77,22 +77,22 @@ - "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_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: "delete temporary files" file: diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-config.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-config.yml index 8aa8f43b..cef5bbff 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-config.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-config.yml @@ -35,7 +35,8 @@ - name: "create haproxy configuration for contrail" template: - src: "provision/haproxy-contrail-cfg.j2" +# src: "provision/haproxy-contrail-cfg.j2" + src: "../../templates/provision/haproxy-contrail-cfg.j2" dest: "/tmp/haproxy-contrail.cfg" - name: "combination of the haproxy configuration" @@ -54,7 +55,7 @@ # Compass is using this #- name: "create keepalived configuration" # template: -# src: "provision/keepalived-conf.j2" +# src: "../../templates/provision/keepalived-conf.j2" # dest: "/etc/keepalived/keepalived.conf" # with_indexed_items: groups['opencontrail_config'] # when: contrail_keepalived and item.1 == inventory_hostname @@ -70,37 +71,37 @@ - name: "fix up contrail keystone auth config" template: - src: "provision/contrail-keystone-auth-conf.j2" + src: "../../templates/provision/contrail-keystone-auth-conf.j2" dest: "/etc/contrail/contrail-keystone-auth.conf" - name: "fix up ifmap server log4j properties" template: - src: "provision/ifmap-log4j-properties.j2" + src: "../../templates/provision/ifmap-log4j-properties.j2" dest: "/etc/ifmap-server/log4j.properties" - name: "fix up ifmap server authorization properties" template: - src: "provision/ifmap-authorization-properties.j2" + src: "../../templates/provision/ifmap-authorization-properties.j2" dest: "/etc/ifmap-server/authorization.properties" - name: "fix up ifmap server basicauthusers properties" template: - src: "provision/ifmap-basicauthusers-properties.j2" + src: "../../templates/provision/ifmap-basicauthusers-properties.j2" dest: "/etc/ifmap-server/basicauthusers.properties" - name: "fix up ifmap server publisher properties" template: - src: "provision/ifmap-publisher-properties.j2" + src: "../../templates/provision/ifmap-publisher-properties.j2" dest: "/etc/ifmap-server/publisher.properties" - name: "fix up contrail api config" template: - src: "provision/contrail-api-conf.j2" + src: "../../templates/provision/contrail-api-conf.j2" dest: "/etc/contrail/contrail-api.conf" - name: "fix up contrail api supervisord config" template: - src: "provision/contrail-api-supervisord-conf.j2" + src: "../../templates/provision/contrail-api-supervisord-conf.j2" dest: "/etc/contrail/supervisord_config_files/contrail-api.ini" - name: "modify contrail api init script" @@ -111,27 +112,27 @@ - name: "fix up contrail schema config" template: - src: "provision/contrail-schema-conf.j2" + src: "../../templates/provision/contrail-schema-conf.j2" dest: "/etc/contrail/contrail-schema.conf" - name: "fix up contrail device manager config" template: - src: "provision/contrail-device-manager-conf.j2" + src: "../../templates/provision/contrail-device-manager-conf.j2" dest: "/etc/contrail/contrail-device-manager.conf" - name: "fix up contrail svc monitor config" template: - src: "provision/contrail-svc-monitor-conf.j2" + src: "../../templates/provision/contrail-svc-monitor-conf.j2" dest: "/etc/contrail/contrail-svc-monitor.conf" - name: "fix up contrail discovery supervisord config" template: - src: "provision/contrail-discovery-supervisord-conf.j2" + src: "../../templates/provision/contrail-discovery-supervisord-conf.j2" dest: "/etc/contrail/supervisord_config_files/contrail-discovery.ini" - name: "fix up contrail discovery config" template: - src: "provision/contrail-discovery-conf.j2" + src: "../../templates/provision/contrail-discovery-conf.j2" dest: "/etc/contrail/contrail-discovery.conf" - name: "modify contrail discovery init script" @@ -142,7 +143,7 @@ - name: "fix up contrail vnc api library config" template: - src: "provision/contrail-vnc-api-lib-ini.j2" + src: "../../templates/provision/contrail-vnc-api-lib-ini.j2" dest: "/etc/contrail/vnc_api_lib.ini" - name: "fix up contrail config nodemgr config" @@ -154,7 +155,7 @@ - name: "fix up contrail sudoers" template: - src: "provision/contrail-sudoers.j2" + src: "../../templates/provision/contrail-sudoers.j2" dest: "/etc/sudoers.d/contrail_sudoers" mode: 0440 @@ -165,7 +166,7 @@ - name: "fix up contrail plugin for nuetron" template: - src: "provision/neutron-contrail-plugin-ini.j2" + src: "../../templates/provision/neutron-contrail-plugin-ini.j2" dest: "/etc/neutron/plugins/opencontrail/ContrailPlugin.ini" - name: "modify neutron server configuration" diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-control.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-control.yml index e36d8f22..1a5ddf7b 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-control.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-control.yml @@ -15,13 +15,15 @@ - name: "modify ifmap server basicauthusers properties for control" lineinfile: dest: "/etc/ifmap-server/basicauthusers.properties" - line: "{{ hostvars[item]['contrail_address' ] }}:{{ hostvars[item]['contrail_address' ] }}" +# line: "{{ hostvars[item]['contrail_address' ] }}:{{ hostvars[item]['contrail_address' ] }}" + line: "{{ contrail_address }}:{{ contrail_address }}" with_items: groups['opencontrail_control'] - name: "modify ifmap server basicauthusers properties for dns" lineinfile: dest: "/etc/ifmap-server/basicauthusers.properties" - line: "{{ hostvars[item]['contrail_address' ] }}.dns:{{ hostvars[item]['contrail_address' ] }}.dns" +# line: "{{ hostvars[item]['contrail_address' ] }}.dns:{{ hostvars[item]['contrail_address' ] }}.dns" + line: "{{ contrail_address }}.dns:{{ contrail_address }}.dns" with_items: groups['opencontrail_control'] - name: "node-common" @@ -29,12 +31,12 @@ - name: "fix up contrail control config" template: - src: "provision/contrail-control-conf.j2" + src: "../../templates/provision/contrail-control-conf.j2" dest: "/etc/contrail/contrail-control.conf" - name: "fix up contrail dns config" template: - src: "provision/contrail-dns-conf.j2" + src: "../../templates/provision/contrail-dns-conf.j2" dest: "/etc/contrail/contrail-dns.conf" - name: "fix up contrail control nodemgr config" diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-database.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-database.yml index 6807d7d4..f95e7feb 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-database.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-database.yml @@ -46,19 +46,25 @@ - { regexp: "^(#(\\s*)?)?initial_token:", line: "# initial_token:" } + - name: "set first database host seed" # sudo: True set_fact: - dbseeds: "{{ hostvars[item.1]['contrail_address'] }}" - with_indexed_items: groups['database'] +# dbseeds: "{{ hostvars[item.1][ contrail_address ] }}" + dbseeds: "{{ contrail_address }}" + with_indexed_items: groups['opencontrail_database'] when: item.0 == 0 + + + - name: "set second database host seed" # sudo: True set_fact: - dbseeds: "{{ dbseeds }},{{ hostvars[item.1]['contrail_address'] }}" - with_indexed_items: groups['database'] +# dbseeds: "{{ dbseeds }},{{ hostvars[item.1]['contrail_address'] }}" + dbseeds: "{{ dbseeds }},{{ contrail_address }}" + with_indexed_items: groups['opencontrail_database'] when: item.0 == 1 @@ -112,16 +118,17 @@ lineinfile: dest: "/etc/zookeeper/conf/zoo.cfg" regexp: "server.{{ item.0 + 1 }}=" - line: "server.{{ item.0 + 1 }}={{ hostvars[item.1]['contrail_address'] }}:2888:3888" - with_indexed_items: groups['database'] +# line: "server.{{ item.0 + 1 }}={{ hostvars[item.1]['contrail_address'] }}:2888:3888" + line: "server.{{ item.0 + 1 }}={{ contrail_address }}:2888:3888" + with_indexed_items: groups['opencontrail_database'] - name: "set zookeeper unique id" # sudo: True template: - src: "templates/zookeeper-unique-id.j2" + src: "../../templates/provision/zookeeper-unique-id.j2" dest: "/var/lib/zookeeper/myid" - with_indexed_items: groups['database'] + with_indexed_items: groups['opencontrail_database'] when: item.1 == inventory_hostname @@ -135,16 +142,18 @@ - name: "set first zookeeper host address" # sudo: True set_fact: - zkaddrs: "{{ hostvars[item.1]['contrail_address'] }}:2181" - with_indexed_items: groups['database'] +# zkaddrs: "{{ hostvars[item.1]['contrail_address'] }}:2181" + zkaddrs: "{{ contrail_address }}:2181" + with_indexed_items: groups['opencontrail_database'] when: item.0 == 0 - name: "set second or more zookeeper host addresses" # sudo: True set_fact: - zkaddrs: "{{ zkaddrs }},{{ hostvars[item.1]['contrail_address'] }}:2181" - with_indexed_items: groups['database'] +# zkaddrs: "{{ zkaddrs }},{{ hostvars[item.1]['contrail_address'] }}:2181" + zkaddrs: "{{ zkaddrs }},{{ contrail_address }}:2181" + with_indexed_items: groups['opencontrail_database'] when: item.0 > 0 diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml index eb6301b2..1090ddaa 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml @@ -16,13 +16,15 @@ - name: "set first cassandra host address" set_fact: - cassandra_addrs: "'{{ hostvars[item.1]['contrail_address'] }}'" +# cassandra_addrs: "'{{ hostvars[item.1]['contrail_address'] }}'" + cassandra_addrs: "'{{ contrail_address }}'" with_indexed_items: groups['opencontrail_database'] when: item.0 == 0 - name: "set second or more cassandra host addresses" set_fact: - cassandra_addrs: "{{ cassandra_addrs }}, '{{ hostvars[item.1]['contrail_address'] }}'" +# cassandra_addrs: "{{ cassandra_addrs }}, '{{ hostvars[item.1]['contrail_address'] }}'" + cassandra_addrs: "{{ cassandra_addrs }}, '{{ contrail_address }}'" with_indexed_items: groups['opencontrail_database'] when: item.0 > 0 -- cgit 1.2.3-korg