diff options
Diffstat (limited to 'mcp/salt-formulas')
-rw-r--r-- | mcp/salt-formulas/maas/machines/delete.sls | 1 | ||||
-rw-r--r-- | mcp/salt-formulas/maas/machines/mark_broken_fixed.sls | 3 | ||||
-rw-r--r-- | mcp/salt-formulas/maas/machines/override_failed_testing.sls | 20 | ||||
-rw-r--r-- | mcp/salt-formulas/maas/machines/set_storage_layout.sls | 20 | ||||
-rw-r--r-- | mcp/salt-formulas/maas/pxe_nat.sls | 37 | ||||
-rw-r--r-- | mcp/salt-formulas/opendaylight/client.sls | 38 | ||||
-rw-r--r-- | mcp/salt-formulas/opendaylight/files/jetty.xml | 33 | ||||
-rw-r--r-- | mcp/salt-formulas/opendaylight/files/setenv.shell | 1 | ||||
-rw-r--r-- | mcp/salt-formulas/opendaylight/map.jinja | 8 | ||||
-rw-r--r-- | mcp/salt-formulas/opendaylight/server.sls | 16 | ||||
-rw-r--r-- | mcp/salt-formulas/opnfv/route_wrapper.sls | 27 |
11 files changed, 121 insertions, 83 deletions
diff --git a/mcp/salt-formulas/maas/machines/delete.sls b/mcp/salt-formulas/maas/machines/delete.sls index dbb625a02..2903f9226 100644 --- a/mcp/salt-formulas/maas/machines/delete.sls +++ b/mcp/salt-formulas/maas/machines/delete.sls @@ -10,6 +10,7 @@ maas_login_admin: cmd.run: - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials" + - unless: 'test -e /var/lib/maas/.maas_credentials' # TODO: implement delete_machine via _modules/maas.py delete_machine: diff --git a/mcp/salt-formulas/maas/machines/mark_broken_fixed.sls b/mcp/salt-formulas/maas/machines/mark_broken_fixed.sls index 17a7df8d8..46691bb09 100644 --- a/mcp/salt-formulas/maas/machines/mark_broken_fixed.sls +++ b/mcp/salt-formulas/maas/machines/mark_broken_fixed.sls @@ -10,10 +10,11 @@ maas_login_admin: cmd.run: - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials" + - unless: 'test -e /var/lib/maas/.maas_credentials' # TODO: implement mark_broken_fixed_machine via _modules/maas.py mark_broken_fixed_machine: cmd.run: - - name: "maas login {{ region.admin.username }} http://{{ region.bind.host }}:5240/MAAS/api/2.0 - < /var/lib/maas/.maas_credentials && maas opnfv machine mark-broken {{ pillar['system_id'] }} && sleep 10 && maas opnfv machine mark-fixed {{ pillar['system_id'] }}" + - name: "maas login {{ region.admin.username }} http://{{ region.bind.host }}:5240/MAAS/api/2.0 - < /var/lib/maas/.maas_credentials && maas opnfv machine mark-broken {{ pillar['system_id'] }} && sleep 10 && maas opnfv machine mark-fixed {{ pillar['system_id'] }} && maas opnfv machine test {{ pillar['system_id'] }} testing_scripts=fio" - require: - cmd: maas_login_admin diff --git a/mcp/salt-formulas/maas/machines/override_failed_testing.sls b/mcp/salt-formulas/maas/machines/override_failed_testing.sls new file mode 100644 index 000000000..e7fe1d267 --- /dev/null +++ b/mcp/salt-formulas/maas/machines/override_failed_testing.sls @@ -0,0 +1,20 @@ +############################################################################## +# Copyright (c) 2018 Mirantis Inc., Enea AB 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 +############################################################################## +{%- from "maas/map.jinja" import region with context %} + +maas_login_admin: + cmd.run: + - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials" + - unless: 'test -e /var/lib/maas/.maas_credentials' + +# TODO: implement override_failed_testing via _modules/maas.py +mark_broken_fixed_machine: + cmd.run: + - name: "maas login {{ region.admin.username }} http://{{ region.bind.host }}:5240/MAAS/api/2.0 - < /var/lib/maas/.maas_credentials && maas opnfv machine override-failed-testing {{ pillar['system_id'] }}" + - require: + - cmd: maas_login_admin diff --git a/mcp/salt-formulas/maas/machines/set_storage_layout.sls b/mcp/salt-formulas/maas/machines/set_storage_layout.sls new file mode 100644 index 000000000..0b7e37153 --- /dev/null +++ b/mcp/salt-formulas/maas/machines/set_storage_layout.sls @@ -0,0 +1,20 @@ +############################################################################## +# Copyright (c) 2018 Mirantis Inc., Enea AB 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 +############################################################################## +{%- from "maas/map.jinja" import region with context %} + +maas_login_admin: + cmd.run: + - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials" + - unless: 'test -e /var/lib/maas/.maas_credentials' + +# TODO: implement set_storage_layout via _modules/maas.py +set_storage_layout: + cmd.run: + - name: "maas login {{ region.admin.username }} http://{{ region.bind.host }}:5240/MAAS/api/2.0 - < /var/lib/maas/.maas_credentials && maas opnfv machine set-storage-layout {{ pillar['system_id'] }} storage_layout={{ pillar['storage_layout'] | default('lvm') }} lv_size={{ pillar['lv_size'] | default('100%') }}" + - require: + - cmd: maas_login_admin diff --git a/mcp/salt-formulas/maas/pxe_nat.sls b/mcp/salt-formulas/maas/pxe_nat.sls new file mode 100644 index 000000000..701bae07a --- /dev/null +++ b/mcp/salt-formulas/maas/pxe_nat.sls @@ -0,0 +1,37 @@ +############################################################################## +# Copyright (c) 2017 Mirantis Inc., Enea AB 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 +############################################################################## +net.ipv4.ip_forward: + sysctl.present: + - value: 1 + +iptables_pxe_nat: + iptables.append: + - table: nat + - chain: POSTROUTING + - jump: MASQUERADE + - destination: 0/0 + - source: {{ salt['pillar.get']('_param:single_address') }}/24 + - save: True + +iptables_pxe_source: + iptables.append: + - table: filter + - chain: INPUT + - jump: ACCEPT + - destination: 0/0 + - source: {{ salt['pillar.get']('_param:single_address') }}/24 + - save: True + +iptables_pxe_destination: + iptables.append: + - table: filter + - chain: INPUT + - jump: ACCEPT + - destination: {{ salt['pillar.get']('_param:single_address') }}/24 + - source: 0/0 + - save: True diff --git a/mcp/salt-formulas/opendaylight/client.sls b/mcp/salt-formulas/opendaylight/client.sls deleted file mode 100644 index dba51b399..000000000 --- a/mcp/salt-formulas/opendaylight/client.sls +++ /dev/null @@ -1,38 +0,0 @@ -############################################################################## -# Copyright (c) 2017 Mirantis Inc. 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 -############################################################################## -{%- from "opendaylight/map.jinja" import client with context %} -{%- if client.get('enabled', True) %} - -opendaylight_client_packages: - pkg.installed: - - pkgs: {{ client.pkgs }} - -{%- if pillar.linux.network.bridge is defined and pillar.linux.network.bridge == 'openvswitch' %} -ovs_set_manager: - cmd.run: - - name: "ovs-vsctl set-manager {{ client.ovsdb_server_iface }} {{ client.ovsdb_odl_iface }}" - - unless: "ovs-vsctl get-manager | grep -Fx {{ client.ovsdb_odl_iface }}" - -ovs_set_tunnel_endpoint: - cmd.run: - - name: "ovs-vsctl set Open_vSwitch . other_config:local_ip={{ client.tunnel_ip }}" - - unless: "ovs-vsctl get Open_vSwitch . other_config | fgrep local_ip" - - require: - - cmd: ovs_set_manager - -{%- if client.provider_mappings is defined %} -ovs_set_provider_mapping: - cmd.run: - - name: "ovs-vsctl set Open_vSwitch . other_config:provider_mappings={{ client.provider_mappings }}" - - unless: "ovs-vsctl get Open_vSwitch . other_config | fgrep provider_mappings" - - require: - - cmd: ovs_set_manager -{%- endif %} - -{%- endif %} -{%- endif %} diff --git a/mcp/salt-formulas/opendaylight/files/jetty.xml b/mcp/salt-formulas/opendaylight/files/jetty.xml index e6371883a..de2ac677d 100644 --- a/mcp/salt-formulas/opendaylight/files/jetty.xml +++ b/mcp/salt-formulas/opendaylight/files/jetty.xml @@ -84,7 +84,7 @@ DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <Property name="jetty.host"/> </Set> <Set name="port"> - <Property name="jetty.port" default="8181"/> + <Property name="jetty.port" default="{{ server.odl_rest_port }}"/> </Set> <Set name="idleTimeout"> <Property name="http.timeout" default="300000"/> @@ -94,37 +94,6 @@ DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> </Arg> </Call> - <Call name="addConnector"> - <Arg> - <New class="org.eclipse.jetty.server.ServerConnector"> - <Arg name="server"> - <Ref refid="Server" /> - </Arg> - <Arg name="factories"> - <Array type="org.eclipse.jetty.server.ConnectionFactory"> - <Item> - <New class="org.eclipse.jetty.server.HttpConnectionFactory"> - <Arg name="config"> - <Ref refid="http-legacy" /> - </Arg> - </New> - </Item> - </Array> - </Arg> - <Set name="host">{{ server.odl_bind_ip }} - <Property name="jetty.host"/> - </Set> - <Set name="port"> - <Property name="jetty.port" default="{{ server.odl_rest_port }}"/> - </Set> - <Set name="idleTimeout"> - <Property name="http.timeout" default="300000"/> - </Set>q - <Set name="name">jetty-legacy</Set> - </New> - </Arg> - </Call> - <!-- =========================================================== --> <!-- Configure Authentication Realms --> <!-- Realms may be configured for the entire server here, or --> diff --git a/mcp/salt-formulas/opendaylight/files/setenv.shell b/mcp/salt-formulas/opendaylight/files/setenv.shell index d7dfbd96c..2921ade14 100644 --- a/mcp/salt-formulas/opendaylight/files/setenv.shell +++ b/mcp/salt-formulas/opendaylight/files/setenv.shell @@ -19,4 +19,3 @@ export EXTRA_JAVA_OPTS='{{ server.java_extra_opts }}' # Additional JVM options # export KARAF_OPTS # Additional available Karaf options # export KARAF_DEBUG # Enable debug mode # export KARAF_REDIRECT # Enable/set the std/err redirection when using bin/start - diff --git a/mcp/salt-formulas/opendaylight/map.jinja b/mcp/salt-formulas/opendaylight/map.jinja index 9e9df1dc1..38575111e 100644 --- a/mcp/salt-formulas/opendaylight/map.jinja +++ b/mcp/salt-formulas/opendaylight/map.jinja @@ -11,7 +11,7 @@ 'karaf_features': {'default': ['standard', 'wrap', 'ssh']}, 'odl_rest_port': '8282', 'odl_bind_ip': '0.0.0.0', - 'repo': 'odl-team/nitrogen', + 'repo': 'odl-team/oxygen', 'log_levels': {}, 'enable_ha': false, 'ha_node_ips': [], @@ -26,9 +26,3 @@ 'repo': 'opendaylight-6-testing' }, }, merge=salt['pillar.get']('opendaylight:server')) %} - -{%- set client = salt['grains.filter_by']({ - 'Debian': { - 'pkgs': ['python-networking-odl'], - }, -}, merge=salt['pillar.get']('opendaylight:client')) %} diff --git a/mcp/salt-formulas/opendaylight/server.sls b/mcp/salt-formulas/opendaylight/server.sls index f953cddc0..51a4d9f95 100644 --- a/mcp/salt-formulas/opendaylight/server.sls +++ b/mcp/salt-formulas/opendaylight/server.sls @@ -15,10 +15,10 @@ opendaylight_repo_key: - name: "apt-key adv --keyserver keyserver.ubuntu.com --recv 44C05248" {%- if system.proxy is defined and system.proxy.keyserver is defined %} - env: -{%- if system.proxy.keyserver.http is defined %} +{%- if system.proxy.keyserver.http is defined and grains['dns']['nameservers'][0] in system.proxy.keyserver.http %} - http_proxy: {{ system.proxy.keyserver.http }} {%- endif %} -{%- if system.proxy.keyserver.https is defined %} +{%- if system.proxy.keyserver.https is defined and grains['dns']['nameservers'][0] in system.proxy.keyserver.https %} - https_proxy: {{ system.proxy.keyserver.https }} {%- endif %} {%- endif %} @@ -29,8 +29,8 @@ opendaylight_repo: # https://github.com/saltstack/salt/pull/45224 # - ppa: {{ server.repo }} - human_name: opendaylight-ppa - - name: deb http://ppa.launchpad.net/odl-team/nitrogen/ubuntu xenial main - - file: /etc/apt/sources.list.d/odl-team-ubuntu-nitrogen-xenial.list + - name: deb http://ppa.launchpad.net/odl-team/{{ server.version }}/ubuntu xenial main + - file: /etc/apt/sources.list.d/odl-team-ubuntu-{{ server.version }}-xenial.list opendaylight: pkg.installed: @@ -49,6 +49,13 @@ opendaylight: - ini: /opt/opendaylight/etc/org.apache.karaf.features.cfg - ini: /opt/opendaylight/etc/org.ops4j.pax.web.cfg +# TODO: use service.masked state once salt get updated to 2017.7.0+ +service.mask: + module.run: + - m_name: opendaylight + - require_in: + - pkg: opendaylight + /opt/opendaylight/etc/jetty.xml: file.managed: - source: salt://opendaylight/files/jetty.xml @@ -78,6 +85,7 @@ opendaylight: ini.options_present: - sections: org.ops4j.pax.web.listening.addresses: {{ server.odl_bind_ip }} + org.osgi.service.http.port: {{ server.odl_rest_port }} {%- if server.get('router_enabled', false) %} /opt/opendaylight/etc/custom.properties: diff --git a/mcp/salt-formulas/opnfv/route_wrapper.sls b/mcp/salt-formulas/opnfv/route_wrapper.sls new file mode 100644 index 000000000..6132f317e --- /dev/null +++ b/mcp/salt-formulas/opnfv/route_wrapper.sls @@ -0,0 +1,27 @@ +############################################################################## +# Copyright (c) 2018 Mirantis Inc., Enea AB 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 +############################################################################## +/usr/local/sbin/route: + file.managed: + - contents: | + #!/bin/sh + + # Workaround salt-managed routes breaking ifup when route already exists + route_binary='/sbin/route' + route_output=$("${route_binary}" "$@" 2>&1) + route_return=$? + + if [ -n "${route_output}" ]; then + if echo "${route_output}" | grep -q 'SIOCADDRT: File exists'; then + exit 0 + fi + echo "${route_output}" + fi + exit "${route_return}" + - user: root + - group: root + - mode: 755 |