From ab18375a629010525ac15bc11ce2d4e4cf393fe9 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 18 Aug 2018 03:46:13 +0200 Subject: [docker] Switch to containerized Salt Master * Refactor OPNFV salt-formulas mechanism to resemble upstream git structure: - git submodules: add new submodule for each formula we patch; - create salt-formula-x directories for OPNFV formulas; - move mcp/metadata/service contents to their each formula subdir; - use `make patches-import` for patches previously handled by patch.sh; - retire patch.sh * states: add virtual_init: - mostly based on old salt.sh, which is now obsolete; - exclude salt-master service restart (it would kill the container); * scenarios: cleanup (rm cfg01 virtual node def), adopt virtual_init; * reclass: align our model with prebuilt container's Salt config: - drop linux:network pillar data (handled by Docker); - stop applying linux.system state on cfg01; - align salt user homedir; - drop salt-formula packages (preprovisioned); * minor plumbing in deploy.sh and lib.sh; JIRA: FUEL-383 Change-Id: I28708a9b399d3f19012212c71966ebda9d6fc0ac Signed-off-by: Alexandru Avadanii --- mcp/salt-formulas/maas/machines/delete.sls | 20 ---- .../maas/machines/mark_broken_fixed.sls | 20 ---- .../maas/machines/override_failed_testing.sls | 20 ---- mcp/salt-formulas/maas/pxe_nat.sls | 37 ------ mcp/salt-formulas/opendaylight/files/jetty.xml | 132 --------------------- mcp/salt-formulas/opendaylight/files/setenv.shell | 21 ---- mcp/salt-formulas/opendaylight/init.sls | 12 -- mcp/salt-formulas/opendaylight/map.jinja | 28 ----- mcp/salt-formulas/opendaylight/server.sls | 113 ------------------ mcp/salt-formulas/salt-formula-keystone | 1 + mcp/salt-formulas/salt-formula-linux | 1 + mcp/salt-formulas/salt-formula-maas | 1 + mcp/salt-formulas/salt-formula-nova | 1 + .../metadata/service/server/single.yml | 20 ++++ .../metadata/service/support.yml | 19 +++ .../opendaylight/files/jetty.xml | 132 +++++++++++++++++++++ .../opendaylight/files/setenv.shell | 21 ++++ .../opendaylight/init.sls | 12 ++ .../opendaylight/map.jinja | 28 +++++ .../opendaylight/server.sls | 113 ++++++++++++++++++ .../metadata/service/server/single.yml | 34 ++++++ .../salt-formula-tacker/tacker/files/tacker.conf | 45 +++++++ .../tacker/files/tacker.systemd | 20 ++++ .../salt-formula-tacker/tacker/init.sls | 11 ++ .../salt-formula-tacker/tacker/map.jinja | 21 ++++ .../salt-formula-tacker/tacker/server.sls | 56 +++++++++ mcp/salt-formulas/tacker/files/tacker.conf | 45 ------- mcp/salt-formulas/tacker/files/tacker.systemd | 20 ---- mcp/salt-formulas/tacker/init.sls | 11 -- mcp/salt-formulas/tacker/map.jinja | 21 ---- mcp/salt-formulas/tacker/server.sls | 56 --------- 31 files changed, 536 insertions(+), 556 deletions(-) delete mode 100644 mcp/salt-formulas/maas/machines/delete.sls delete mode 100644 mcp/salt-formulas/maas/machines/mark_broken_fixed.sls delete mode 100644 mcp/salt-formulas/maas/machines/override_failed_testing.sls delete mode 100644 mcp/salt-formulas/maas/pxe_nat.sls delete mode 100644 mcp/salt-formulas/opendaylight/files/jetty.xml delete mode 100644 mcp/salt-formulas/opendaylight/files/setenv.shell delete mode 100644 mcp/salt-formulas/opendaylight/init.sls delete mode 100644 mcp/salt-formulas/opendaylight/map.jinja delete mode 100644 mcp/salt-formulas/opendaylight/server.sls create mode 160000 mcp/salt-formulas/salt-formula-keystone create mode 160000 mcp/salt-formulas/salt-formula-linux create mode 160000 mcp/salt-formulas/salt-formula-maas create mode 160000 mcp/salt-formulas/salt-formula-nova create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/metadata/service/server/single.yml create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/metadata/service/support.yml create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/jetty.xml create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/setenv.shell create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/opendaylight/init.sls create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja create mode 100644 mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls create mode 100644 mcp/salt-formulas/salt-formula-tacker/metadata/service/server/single.yml create mode 100644 mcp/salt-formulas/salt-formula-tacker/tacker/files/tacker.conf create mode 100644 mcp/salt-formulas/salt-formula-tacker/tacker/files/tacker.systemd create mode 100644 mcp/salt-formulas/salt-formula-tacker/tacker/init.sls create mode 100644 mcp/salt-formulas/salt-formula-tacker/tacker/map.jinja create mode 100644 mcp/salt-formulas/salt-formula-tacker/tacker/server.sls delete mode 100644 mcp/salt-formulas/tacker/files/tacker.conf delete mode 100644 mcp/salt-formulas/tacker/files/tacker.systemd delete mode 100644 mcp/salt-formulas/tacker/init.sls delete mode 100644 mcp/salt-formulas/tacker/map.jinja delete mode 100644 mcp/salt-formulas/tacker/server.sls (limited to 'mcp/salt-formulas') diff --git a/mcp/salt-formulas/maas/machines/delete.sls b/mcp/salt-formulas/maas/machines/delete.sls deleted file mode 100644 index 2903f9226..000000000 --- a/mcp/salt-formulas/maas/machines/delete.sls +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################## -# 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 -############################################################################## -{%- 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 delete_machine via _modules/maas.py -delete_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 delete {{ pillar['system_id'] }}" - - require: - - cmd: maas_login_admin diff --git a/mcp/salt-formulas/maas/machines/mark_broken_fixed.sls b/mcp/salt-formulas/maas/machines/mark_broken_fixed.sls deleted file mode 100644 index 46691bb09..000000000 --- a/mcp/salt-formulas/maas/machines/mark_broken_fixed.sls +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################## -# 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 -############################################################################## -{%- 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 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'] }} && 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 deleted file mode 100644 index e7fe1d267..000000000 --- a/mcp/salt-formulas/maas/machines/override_failed_testing.sls +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################## -# 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/pxe_nat.sls b/mcp/salt-formulas/maas/pxe_nat.sls deleted file mode 100644 index 8a03c4fdb..000000000 --- a/mcp/salt-formulas/maas/pxe_nat.sls +++ /dev/null @@ -1,37 +0,0 @@ -############################################################################## -# 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') }}/{{ salt['pillar.get']('_param:opnfv_net_admin_mask') }} - - save: True - -iptables_pxe_source: - iptables.append: - - table: filter - - chain: INPUT - - jump: ACCEPT - - destination: 0/0 - - source: {{ salt['pillar.get']('_param:single_address') }}/{{ salt['pillar.get']('_param:opnfv_net_admin_mask') }} - - save: True - -iptables_pxe_destination: - iptables.append: - - table: filter - - chain: INPUT - - jump: ACCEPT - - destination: {{ salt['pillar.get']('_param:single_address') }}/{{ salt['pillar.get']('_param:opnfv_net_admin_mask') }} - - source: 0/0 - - save: True diff --git a/mcp/salt-formulas/opendaylight/files/jetty.xml b/mcp/salt-formulas/opendaylight/files/jetty.xml deleted file mode 100644 index de2ac677d..000000000 --- a/mcp/salt-formulas/opendaylight/files/jetty.xml +++ /dev/null @@ -1,132 +0,0 @@ -{%- from "opendaylight/map.jinja" import server with context -%} - - - - - - - - - - - - - - - https - - - - 32768 - 8192 - 8192 - - - false - - false - 512 - - - - https - - - - 32768 - 8192 - 8192 - - - false - - false - 512 - - - - - - - - - - - - - - - - - - - - {{ server.odl_bind_ip }} - - - - - - - - - jetty-default - - - - - - - - - - - - - - - karaf - karaf - - - org.apache.karaf.jaas.boot.principal.RolePrincipal - - - - - - - - - - default - karaf - - - org.apache.karaf.jaas.boot.principal.RolePrincipal - - - - - - - diff --git a/mcp/salt-formulas/opendaylight/files/setenv.shell b/mcp/salt-formulas/opendaylight/files/setenv.shell deleted file mode 100644 index 2921ade14..000000000 --- a/mcp/salt-formulas/opendaylight/files/setenv.shell +++ /dev/null @@ -1,21 +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 server with context -%} -# export JAVA_HOME # Location of Java installation -export JAVA_MIN_MEM={{ server.java_min_mem }} # Minimum memory for the JVM -export JAVA_MAX_MEM={{ server.java_max_mem }} # Maximum memory for the JVM -# export JAVA_PERM_MEM # Minimum perm memory for the JVM -export JAVA_MAX_PERM_MEM=512m # Maximum perm memory for the JVM -export EXTRA_JAVA_OPTS='{{ server.java_extra_opts }}' # Additional JVM options -# export KARAF_HOME # Karaf home folder -# export KARAF_DATA # Karaf data folder -# export KARAF_BASE # Karaf base folder -# export KARAF_ETC # Karaf etc folder -# 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/init.sls b/mcp/salt-formulas/opendaylight/init.sls deleted file mode 100644 index 132f69b33..000000000 --- a/mcp/salt-formulas/opendaylight/init.sls +++ /dev/null @@ -1,12 +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 -############################################################################## - -include: -{% if pillar.opendaylight.server is defined %} -- opendaylight.server -{% endif %} diff --git a/mcp/salt-formulas/opendaylight/map.jinja b/mcp/salt-formulas/opendaylight/map.jinja deleted file mode 100644 index 38575111e..000000000 --- a/mcp/salt-formulas/opendaylight/map.jinja +++ /dev/null @@ -1,28 +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 -############################################################################## - -{% set server = salt['grains.filter_by']({ - 'Debian': { - 'karaf_features': {'default': ['standard', 'wrap', 'ssh']}, - 'odl_rest_port': '8282', - 'odl_bind_ip': '0.0.0.0', - 'repo': 'odl-team/oxygen', - 'log_levels': {}, - 'enable_ha': false, - 'ha_node_ips': [], - 'ha_node_index': 0, - 'security_group_mode': 'stateful', - 'vpp_routing_node': '', - 'java_extra_opts': '-Djava.net.preferIPv4Stack=true -XX:+UseG1GC', - 'java_min_mem': '1g', - 'java_max_mem': '2g', - }, - 'RedHat': { - 'repo': 'opendaylight-6-testing' - }, -}, merge=salt['pillar.get']('opendaylight:server')) %} diff --git a/mcp/salt-formulas/opendaylight/server.sls b/mcp/salt-formulas/opendaylight/server.sls deleted file mode 100644 index 206dc52a2..000000000 --- a/mcp/salt-formulas/opendaylight/server.sls +++ /dev/null @@ -1,113 +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 server with context %} -{% from "linux/map.jinja" import system with context %} - -{%- if server.enabled %} - -opendaylight_repo_key: - cmd.run: - - name: "apt-key adv --keyserver keyserver.ubuntu.com --recv 44C05248" -{%- if system.proxy is defined and system.proxy.pkg is defined %} - - env: -{%- if system.proxy.pkg.http is defined %} - - http_proxy: {{ system.proxy.pkg.http }} -{%- endif %} -{%- if system.proxy.pkg.https is defined %} - - https_proxy: {{ system.proxy.pkg.https }} -{%- endif %} -{%- endif %} - -opendaylight_repo: - pkgrepo.managed: - # NOTE(armband): PPA handling behind proxy broken, define it explicitly - # https://github.com/saltstack/salt/pull/45224 - # - ppa: {{ server.repo }} - - human_name: opendaylight-ppa - - 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 - -{%- if grains['saltversioninfo'] < [2017, 7] %} -service.mask: - module.run: - - m_name: opendaylight -{%- else %} -opendaylight_service_mask: - service.masked: - - name: opendaylight -{%- endif %} - -opendaylight: - pkg.installed: - - require: - - pkgrepo: opendaylight_repo - - require_in: - - file: /opt/opendaylight/etc/jetty.xml - - file: /opt/opendaylight/bin/setenv - - ini: /opt/opendaylight/etc/org.apache.karaf.features.cfg - - ini: /opt/opendaylight/etc/org.ops4j.pax.web.cfg - service.running: - - enable: true -{%- if grains['saltversioninfo'] >= [2017, 7] %} - - unmask: true -{%- endif %} - - watch: - - file: /opt/opendaylight/etc/jetty.xml - - file: /opt/opendaylight/bin/setenv - - ini: /opt/opendaylight/etc/org.apache.karaf.features.cfg - - ini: /opt/opendaylight/etc/org.ops4j.pax.web.cfg - -/opt/opendaylight/etc/jetty.xml: - file.managed: - - source: salt://opendaylight/files/jetty.xml - - template: jinja - - user: odl - - group: odl - -/opt/opendaylight/bin/setenv: - file.managed: - - source: salt://opendaylight/files/setenv.shell - - mode: 0755 - - use: - - file: /opt/opendaylight/etc/jetty.xml - -{% set features %} -{%- for f in server.karaf_features.itervalues() -%} -{{ f | join(',') }}{%- if not loop.last %},{%- endif %} -{%- endfor %} -{% endset %} - -/opt/opendaylight/etc/org.apache.karaf.features.cfg: - ini.options_present: - - sections: - featuresBoot: {{ features }} - -/opt/opendaylight/etc/org.ops4j.pax.web.cfg: - 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: - ini.options_present: - - sections: - ovsdb.l3.fwd.enabled: 'yes' - ovsdb.of.version: 1.3 - - require: - - pkg: opendaylight - - watch_in: - - service: opendaylight -{%- endif %} - -{%- if grains['cpuarch'] == 'aarch64' %} -opendaylight-leveldbjni: - pkg.installed -{%- endif %} - -{%- endif %} diff --git a/mcp/salt-formulas/salt-formula-keystone b/mcp/salt-formulas/salt-formula-keystone new file mode 160000 index 000000000..df75142aa --- /dev/null +++ b/mcp/salt-formulas/salt-formula-keystone @@ -0,0 +1 @@ +Subproject commit df75142aaf6487c3af9e2868f4f12ef18228ca99 diff --git a/mcp/salt-formulas/salt-formula-linux b/mcp/salt-formulas/salt-formula-linux new file mode 160000 index 000000000..cf1b5b322 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-linux @@ -0,0 +1 @@ +Subproject commit cf1b5b322a077dc8d6f9bf5b36a7a0a71a2b3a06 diff --git a/mcp/salt-formulas/salt-formula-maas b/mcp/salt-formulas/salt-formula-maas new file mode 160000 index 000000000..c6a12dea5 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-maas @@ -0,0 +1 @@ +Subproject commit c6a12dea5f8d8c7c700f596dbabb805113f1d341 diff --git a/mcp/salt-formulas/salt-formula-nova b/mcp/salt-formulas/salt-formula-nova new file mode 160000 index 000000000..539e9938e --- /dev/null +++ b/mcp/salt-formulas/salt-formula-nova @@ -0,0 +1 @@ +Subproject commit 539e9938e74f8a1ad19c2c1a653761df53bc24b7 diff --git a/mcp/salt-formulas/salt-formula-opendaylight/metadata/service/server/single.yml b/mcp/salt-formulas/salt-formula-opendaylight/metadata/service/server/single.yml new file mode 100644 index 000000000..3a762b39a --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/metadata/service/server/single.yml @@ -0,0 +1,20 @@ +############################################################################## +# 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 +############################################################################## +--- +applications: + - opendaylight +parameters: + _param: + version: oxygen + opendaylight: + server: + enabled: 'True' + version: ${_param:version} + repo: 'odl-team/${_param:version}' + logging: + engine: syslog diff --git a/mcp/salt-formulas/salt-formula-opendaylight/metadata/service/support.yml b/mcp/salt-formulas/salt-formula-opendaylight/metadata/service/support.yml new file mode 100644 index 000000000..bbb204315 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/metadata/service/support.yml @@ -0,0 +1,19 @@ +############################################################################## +# 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 +############################################################################## +--- +parameters: + opendaylight: + _support: + collectd: + enabled: false + heka: + enabled: false + sensu: + enabled: false + sphinx: + enabled: false diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/jetty.xml b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/jetty.xml new file mode 100644 index 000000000..de2ac677d --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/jetty.xml @@ -0,0 +1,132 @@ +{%- from "opendaylight/map.jinja" import server with context -%} + + + + + + + + + + + + + + + https + + + + 32768 + 8192 + 8192 + + + false + + false + 512 + + + + https + + + + 32768 + 8192 + 8192 + + + false + + false + 512 + + + + + + + + + + + + + + + + + + + + {{ server.odl_bind_ip }} + + + + + + + + + jetty-default + + + + + + + + + + + + + + + karaf + karaf + + + org.apache.karaf.jaas.boot.principal.RolePrincipal + + + + + + + + + + default + karaf + + + org.apache.karaf.jaas.boot.principal.RolePrincipal + + + + + + + diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/setenv.shell b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/setenv.shell new file mode 100644 index 000000000..2921ade14 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/setenv.shell @@ -0,0 +1,21 @@ +############################################################################## +# 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 server with context -%} +# export JAVA_HOME # Location of Java installation +export JAVA_MIN_MEM={{ server.java_min_mem }} # Minimum memory for the JVM +export JAVA_MAX_MEM={{ server.java_max_mem }} # Maximum memory for the JVM +# export JAVA_PERM_MEM # Minimum perm memory for the JVM +export JAVA_MAX_PERM_MEM=512m # Maximum perm memory for the JVM +export EXTRA_JAVA_OPTS='{{ server.java_extra_opts }}' # Additional JVM options +# export KARAF_HOME # Karaf home folder +# export KARAF_DATA # Karaf data folder +# export KARAF_BASE # Karaf base folder +# export KARAF_ETC # Karaf etc folder +# 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/salt-formula-opendaylight/opendaylight/init.sls b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/init.sls new file mode 100644 index 000000000..132f69b33 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/init.sls @@ -0,0 +1,12 @@ +############################################################################## +# 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 +############################################################################## + +include: +{% if pillar.opendaylight.server is defined %} +- opendaylight.server +{% endif %} diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja new file mode 100644 index 000000000..38575111e --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/map.jinja @@ -0,0 +1,28 @@ +############################################################################## +# 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 +############################################################################## + +{% set server = salt['grains.filter_by']({ + 'Debian': { + 'karaf_features': {'default': ['standard', 'wrap', 'ssh']}, + 'odl_rest_port': '8282', + 'odl_bind_ip': '0.0.0.0', + 'repo': 'odl-team/oxygen', + 'log_levels': {}, + 'enable_ha': false, + 'ha_node_ips': [], + 'ha_node_index': 0, + 'security_group_mode': 'stateful', + 'vpp_routing_node': '', + 'java_extra_opts': '-Djava.net.preferIPv4Stack=true -XX:+UseG1GC', + 'java_min_mem': '1g', + 'java_max_mem': '2g', + }, + 'RedHat': { + 'repo': 'opendaylight-6-testing' + }, +}, merge=salt['pillar.get']('opendaylight:server')) %} diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls new file mode 100644 index 000000000..206dc52a2 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls @@ -0,0 +1,113 @@ +############################################################################## +# 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 server with context %} +{% from "linux/map.jinja" import system with context %} + +{%- if server.enabled %} + +opendaylight_repo_key: + cmd.run: + - name: "apt-key adv --keyserver keyserver.ubuntu.com --recv 44C05248" +{%- if system.proxy is defined and system.proxy.pkg is defined %} + - env: +{%- if system.proxy.pkg.http is defined %} + - http_proxy: {{ system.proxy.pkg.http }} +{%- endif %} +{%- if system.proxy.pkg.https is defined %} + - https_proxy: {{ system.proxy.pkg.https }} +{%- endif %} +{%- endif %} + +opendaylight_repo: + pkgrepo.managed: + # NOTE(armband): PPA handling behind proxy broken, define it explicitly + # https://github.com/saltstack/salt/pull/45224 + # - ppa: {{ server.repo }} + - human_name: opendaylight-ppa + - 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 + +{%- if grains['saltversioninfo'] < [2017, 7] %} +service.mask: + module.run: + - m_name: opendaylight +{%- else %} +opendaylight_service_mask: + service.masked: + - name: opendaylight +{%- endif %} + +opendaylight: + pkg.installed: + - require: + - pkgrepo: opendaylight_repo + - require_in: + - file: /opt/opendaylight/etc/jetty.xml + - file: /opt/opendaylight/bin/setenv + - ini: /opt/opendaylight/etc/org.apache.karaf.features.cfg + - ini: /opt/opendaylight/etc/org.ops4j.pax.web.cfg + service.running: + - enable: true +{%- if grains['saltversioninfo'] >= [2017, 7] %} + - unmask: true +{%- endif %} + - watch: + - file: /opt/opendaylight/etc/jetty.xml + - file: /opt/opendaylight/bin/setenv + - ini: /opt/opendaylight/etc/org.apache.karaf.features.cfg + - ini: /opt/opendaylight/etc/org.ops4j.pax.web.cfg + +/opt/opendaylight/etc/jetty.xml: + file.managed: + - source: salt://opendaylight/files/jetty.xml + - template: jinja + - user: odl + - group: odl + +/opt/opendaylight/bin/setenv: + file.managed: + - source: salt://opendaylight/files/setenv.shell + - mode: 0755 + - use: + - file: /opt/opendaylight/etc/jetty.xml + +{% set features %} +{%- for f in server.karaf_features.itervalues() -%} +{{ f | join(',') }}{%- if not loop.last %},{%- endif %} +{%- endfor %} +{% endset %} + +/opt/opendaylight/etc/org.apache.karaf.features.cfg: + ini.options_present: + - sections: + featuresBoot: {{ features }} + +/opt/opendaylight/etc/org.ops4j.pax.web.cfg: + 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: + ini.options_present: + - sections: + ovsdb.l3.fwd.enabled: 'yes' + ovsdb.of.version: 1.3 + - require: + - pkg: opendaylight + - watch_in: + - service: opendaylight +{%- endif %} + +{%- if grains['cpuarch'] == 'aarch64' %} +opendaylight-leveldbjni: + pkg.installed +{%- endif %} + +{%- endif %} diff --git a/mcp/salt-formulas/salt-formula-tacker/metadata/service/server/single.yml b/mcp/salt-formulas/salt-formula-tacker/metadata/service/server/single.yml new file mode 100644 index 000000000..597d9f8fb --- /dev/null +++ b/mcp/salt-formulas/salt-formula-tacker/metadata/service/server/single.yml @@ -0,0 +1,34 @@ +############################################################################## +# Copyright (c) 2018 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 +############################################################################## +--- +classes: + - service.git.client +parameters: + _param: + keystone_tacker_endpoint_type: internalURL + tacker: + server: + bind_host: ${_param:cluster_local_address} + enabled: true + branch: stable/queens + database: + engine: mysql + host: ${_param:single_address} + port: 3306 + name: tacker + user: tacker + password: ${_param:mysql_tacker_password} + identity: + engine: keystone + region: RegionOne + host: ${_param:single_address} + port: 35357 + user: tacker + password: ${_param:keystone_tacker_password} + tenant: service + endpoint_type: ${_param:keystone_tacker_endpoint_type} diff --git a/mcp/salt-formulas/salt-formula-tacker/tacker/files/tacker.conf b/mcp/salt-formulas/salt-formula-tacker/tacker/files/tacker.conf new file mode 100644 index 000000000..7adfd3139 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-tacker/tacker/files/tacker.conf @@ -0,0 +1,45 @@ +############################################################################## +# Copyright (c) 2018 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 "tacker/map.jinja" import server with context %} + +[DEFAULT] +auth_strategy = keystone +policy_file = /usr/local/etc/tacker/policy.json +debug = True +use_syslog = False +bind_host = {{ server.bind_host }} +bind_port = 9890 +service_plugins = nfvo,vnfm + +state_path = /var/lib/tacker + +[nfvo_vim] +vim_drivers = openstack + +[keystone_authtoken] +region_name = {{ server.identity.region }} +auth_type = password +user_domain_id = {{ server.identity.get('domain', 'default') }} +project_domain_id = {{ server.identity.get('domain', 'default') }} +project_name = {{ server.identity.tenant }} +username = {{ server.identity.user }} +password = {{ server.identity.password }} +auth_url = http://{{ server.identity.host }}:35357 +www_authenticate_uri = http://{{ server.identity.host }}:5000 +{%- if server.cache is defined %} +memcached_servers={%- for member in server.cache.members %}{{ member.host }}:11211{% if not loop.last %},{% endif %}{%- endfor %} +{%- endif %} + +[agent] +root_helper = sudo /usr/local/bin/tacker-rootwrap /usr/local/etc/tacker/rootwrap.conf + +[database] +connection = {{ server.database.engine }}+pymysql://{{ server.database.user }}:{{ server.database.password }}@{{ server.database.host }}/{{ server.database.name }}?charset=utf8 + +[tacker] +monitor_driver = ping,http_ping diff --git a/mcp/salt-formulas/salt-formula-tacker/tacker/files/tacker.systemd b/mcp/salt-formulas/salt-formula-tacker/tacker/files/tacker.systemd new file mode 100644 index 000000000..12ff5cdde --- /dev/null +++ b/mcp/salt-formulas/salt-formula-tacker/tacker/files/tacker.systemd @@ -0,0 +1,20 @@ +############################################################################## +# Copyright (c) 2018 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 +############################################################################## +[Unit] +Description = OpenStack Tacker service + +[Service] +ExecReload = /bin/kill -HUP $MAINPID +TimeoutStopSec = 300 +KillMode = process +WorkingDirectory = /tmp +ExecStartPre=/bin/mkdir -p /var/log/tacker +ExecStart=/usr/local/bin/tacker-server --config-file /usr/local/etc/tacker/tacker.conf --log-file /var/log/tacker/tacker.log + +[Install] +WantedBy = multi-user.target diff --git a/mcp/salt-formulas/salt-formula-tacker/tacker/init.sls b/mcp/salt-formulas/salt-formula-tacker/tacker/init.sls new file mode 100644 index 000000000..35291b8f9 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-tacker/tacker/init.sls @@ -0,0 +1,11 @@ +############################################################################## +# Copyright (c) 2018 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 +############################################################################## +include: +{%- if pillar.tacker.server is defined %} +- tacker.server +{%- endif %} diff --git a/mcp/salt-formulas/salt-formula-tacker/tacker/map.jinja b/mcp/salt-formulas/salt-formula-tacker/tacker/map.jinja new file mode 100644 index 000000000..9a35c8e52 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-tacker/tacker/map.jinja @@ -0,0 +1,21 @@ +{#- + Copyright (c) 2018 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 +-#} +{% set server = salt['grains.filter_by']({ + 'Debian': { + 'pkgs': ['python-heat-translator', 'python-tosca-parser', 'python-tackerclient'], + 'bind_host': '0.0.0.0', + 'git': { + 'source': 'https://github.com/openstack/tacker', + 'target': '/tmp/tacker', + 'branch': 'master', + }, + }, + 'RedHat': { + 'pkgs': 'openstack-tacker' + }, +}, merge=salt['pillar.get']('tacker:server')) %} diff --git a/mcp/salt-formulas/salt-formula-tacker/tacker/server.sls b/mcp/salt-formulas/salt-formula-tacker/tacker/server.sls new file mode 100644 index 000000000..eb3468a11 --- /dev/null +++ b/mcp/salt-formulas/salt-formula-tacker/tacker/server.sls @@ -0,0 +1,56 @@ +############################################################################## +# Copyright (c) 2018 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 "tacker/map.jinja" import server with context %} +{%- if server.enabled %} + +include: +- git + +{{ server.git.source }}: + git.latest: + - target: {{ server.git.target }} + - rev: {{ server.git.branch }} + - depth: 1 + +tacker_packages: + pkg.installed: + - names: {{ server.pkgs }} + +tacker_install: + cmd.run: + - name: python setup.py install + - cwd: {{ server.git.target }} + - creates: /usr/local/bin/tacker-server + - require: + - git: {{ server.git.source }} + +/usr/local/etc/tacker/tacker.conf: + file.managed: + - source: salt://tacker/files/tacker.conf + - template: jinja + - makedirs: true + - require: + - cmd: tacker_install + +tacker_db_manage: + cmd.run: + - name: /usr/local/bin/tacker-db-manage --config-file /usr/local/etc/tacker/tacker.conf upgrade head + - require: + - file: /usr/local/etc/tacker/tacker.conf + +/lib/systemd/system/tacker.service: + file.managed: + - source: salt://tacker/files/tacker.systemd + +tacker: + service.running: + - enable: true + - watch: + - file: /usr/local/etc/tacker/tacker.conf + +{%- endif %} diff --git a/mcp/salt-formulas/tacker/files/tacker.conf b/mcp/salt-formulas/tacker/files/tacker.conf deleted file mode 100644 index 7adfd3139..000000000 --- a/mcp/salt-formulas/tacker/files/tacker.conf +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################## -# Copyright (c) 2018 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 "tacker/map.jinja" import server with context %} - -[DEFAULT] -auth_strategy = keystone -policy_file = /usr/local/etc/tacker/policy.json -debug = True -use_syslog = False -bind_host = {{ server.bind_host }} -bind_port = 9890 -service_plugins = nfvo,vnfm - -state_path = /var/lib/tacker - -[nfvo_vim] -vim_drivers = openstack - -[keystone_authtoken] -region_name = {{ server.identity.region }} -auth_type = password -user_domain_id = {{ server.identity.get('domain', 'default') }} -project_domain_id = {{ server.identity.get('domain', 'default') }} -project_name = {{ server.identity.tenant }} -username = {{ server.identity.user }} -password = {{ server.identity.password }} -auth_url = http://{{ server.identity.host }}:35357 -www_authenticate_uri = http://{{ server.identity.host }}:5000 -{%- if server.cache is defined %} -memcached_servers={%- for member in server.cache.members %}{{ member.host }}:11211{% if not loop.last %},{% endif %}{%- endfor %} -{%- endif %} - -[agent] -root_helper = sudo /usr/local/bin/tacker-rootwrap /usr/local/etc/tacker/rootwrap.conf - -[database] -connection = {{ server.database.engine }}+pymysql://{{ server.database.user }}:{{ server.database.password }}@{{ server.database.host }}/{{ server.database.name }}?charset=utf8 - -[tacker] -monitor_driver = ping,http_ping diff --git a/mcp/salt-formulas/tacker/files/tacker.systemd b/mcp/salt-formulas/tacker/files/tacker.systemd deleted file mode 100644 index 12ff5cdde..000000000 --- a/mcp/salt-formulas/tacker/files/tacker.systemd +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################## -# Copyright (c) 2018 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 -############################################################################## -[Unit] -Description = OpenStack Tacker service - -[Service] -ExecReload = /bin/kill -HUP $MAINPID -TimeoutStopSec = 300 -KillMode = process -WorkingDirectory = /tmp -ExecStartPre=/bin/mkdir -p /var/log/tacker -ExecStart=/usr/local/bin/tacker-server --config-file /usr/local/etc/tacker/tacker.conf --log-file /var/log/tacker/tacker.log - -[Install] -WantedBy = multi-user.target diff --git a/mcp/salt-formulas/tacker/init.sls b/mcp/salt-formulas/tacker/init.sls deleted file mode 100644 index 35291b8f9..000000000 --- a/mcp/salt-formulas/tacker/init.sls +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################## -# Copyright (c) 2018 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 -############################################################################## -include: -{%- if pillar.tacker.server is defined %} -- tacker.server -{%- endif %} diff --git a/mcp/salt-formulas/tacker/map.jinja b/mcp/salt-formulas/tacker/map.jinja deleted file mode 100644 index 9a35c8e52..000000000 --- a/mcp/salt-formulas/tacker/map.jinja +++ /dev/null @@ -1,21 +0,0 @@ -{#- - Copyright (c) 2018 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 --#} -{% set server = salt['grains.filter_by']({ - 'Debian': { - 'pkgs': ['python-heat-translator', 'python-tosca-parser', 'python-tackerclient'], - 'bind_host': '0.0.0.0', - 'git': { - 'source': 'https://github.com/openstack/tacker', - 'target': '/tmp/tacker', - 'branch': 'master', - }, - }, - 'RedHat': { - 'pkgs': 'openstack-tacker' - }, -}, merge=salt['pillar.get']('tacker:server')) %} diff --git a/mcp/salt-formulas/tacker/server.sls b/mcp/salt-formulas/tacker/server.sls deleted file mode 100644 index eb3468a11..000000000 --- a/mcp/salt-formulas/tacker/server.sls +++ /dev/null @@ -1,56 +0,0 @@ -############################################################################## -# Copyright (c) 2018 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 "tacker/map.jinja" import server with context %} -{%- if server.enabled %} - -include: -- git - -{{ server.git.source }}: - git.latest: - - target: {{ server.git.target }} - - rev: {{ server.git.branch }} - - depth: 1 - -tacker_packages: - pkg.installed: - - names: {{ server.pkgs }} - -tacker_install: - cmd.run: - - name: python setup.py install - - cwd: {{ server.git.target }} - - creates: /usr/local/bin/tacker-server - - require: - - git: {{ server.git.source }} - -/usr/local/etc/tacker/tacker.conf: - file.managed: - - source: salt://tacker/files/tacker.conf - - template: jinja - - makedirs: true - - require: - - cmd: tacker_install - -tacker_db_manage: - cmd.run: - - name: /usr/local/bin/tacker-db-manage --config-file /usr/local/etc/tacker/tacker.conf upgrade head - - require: - - file: /usr/local/etc/tacker/tacker.conf - -/lib/systemd/system/tacker.service: - file.managed: - - source: salt://tacker/files/tacker.systemd - -tacker: - service.running: - - enable: true - - watch: - - file: /usr/local/etc/tacker/tacker.conf - -{%- endif %} -- cgit 1.2.3-korg