diff options
author | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2018-08-18 03:46:13 +0200 |
---|---|---|
committer | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2018-08-29 01:27:28 +0200 |
commit | ab18375a629010525ac15bc11ce2d4e4cf393fe9 (patch) | |
tree | 38dc93fe27b88db9ebe489e4c685b06e4b80561e /mcp/patches/salt-formula-maas/0003-Add-machines.delete-co-pxe_nat-sls.patch | |
parent | cfa1c0d67ee23edcbc25d9620754159645981dd8 (diff) |
[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 <Alexandru.Avadanii@enea.com>
Diffstat (limited to 'mcp/patches/salt-formula-maas/0003-Add-machines.delete-co-pxe_nat-sls.patch')
-rw-r--r-- | mcp/patches/salt-formula-maas/0003-Add-machines.delete-co-pxe_nat-sls.patch | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/mcp/patches/salt-formula-maas/0003-Add-machines.delete-co-pxe_nat-sls.patch b/mcp/patches/salt-formula-maas/0003-Add-machines.delete-co-pxe_nat-sls.patch new file mode 100644 index 000000000..9f13c4616 --- /dev/null +++ b/mcp/patches/salt-formula-maas/0003-Add-machines.delete-co-pxe_nat-sls.patch @@ -0,0 +1,137 @@ +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com> +Date: Sun, 19 Aug 2018 05:38:27 +0200 +Subject: [PATCH] Add machines.delete & co, pxe_nat sls + +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> +--- + maas/machines/delete.sls | 20 ++++++++++++ + maas/machines/mark_broken_fixed.sls | 20 ++++++++++++ + maas/machines/override_failed_testing.sls | 20 ++++++++++++ + maas/pxe_nat.sls | 37 +++++++++++++++++++++++ + 4 files changed, 97 insertions(+) + create mode 100644 maas/machines/delete.sls + create mode 100644 maas/machines/mark_broken_fixed.sls + create mode 100644 maas/machines/override_failed_testing.sls + create mode 100644 maas/pxe_nat.sls + +diff --git a/maas/machines/delete.sls b/maas/machines/delete.sls +new file mode 100644 +index 0000000..2903f92 +--- /dev/null ++++ b/maas/machines/delete.sls +@@ -0,0 +1,20 @@ ++############################################################################## ++# 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/maas/machines/mark_broken_fixed.sls b/maas/machines/mark_broken_fixed.sls +new file mode 100644 +index 0000000..46691bb +--- /dev/null ++++ b/maas/machines/mark_broken_fixed.sls +@@ -0,0 +1,20 @@ ++############################################################################## ++# 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/maas/machines/override_failed_testing.sls b/maas/machines/override_failed_testing.sls +new file mode 100644 +index 0000000..e7fe1d2 +--- /dev/null ++++ b/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/maas/pxe_nat.sls b/maas/pxe_nat.sls +new file mode 100644 +index 0000000..8a03c4f +--- /dev/null ++++ b/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') }}/{{ 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 |