1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Sun, 19 Aug 2018 05:38:27 +0200
3 Subject: [PATCH] Add machines.delete & co, pxe_nat sls
5 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
7 maas/machines/delete.sls | 20 ++++++++++++
8 maas/machines/mark_broken_fixed.sls | 20 ++++++++++++
9 maas/machines/override_failed_testing.sls | 20 ++++++++++++
10 maas/pxe_nat.sls | 37 +++++++++++++++++++++++
11 4 files changed, 97 insertions(+)
12 create mode 100644 maas/machines/delete.sls
13 create mode 100644 maas/machines/mark_broken_fixed.sls
14 create mode 100644 maas/machines/override_failed_testing.sls
15 create mode 100644 maas/pxe_nat.sls
17 diff --git a/maas/machines/delete.sls b/maas/machines/delete.sls
19 index 0000000..2903f92
21 +++ b/maas/machines/delete.sls
23 +##############################################################################
24 +# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
25 +# All rights reserved. This program and the accompanying materials
26 +# are made available under the terms of the Apache License, Version 2.0
27 +# which accompanies this distribution, and is available at
28 +# http://www.apache.org/licenses/LICENSE-2.0
29 +##############################################################################
30 +{%- from "maas/map.jinja" import region with context %}
34 + - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials"
35 + - unless: 'test -e /var/lib/maas/.maas_credentials'
37 +# TODO: implement delete_machine via _modules/maas.py
40 + - 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'] }}"
42 + - cmd: maas_login_admin
43 diff --git a/maas/machines/mark_broken_fixed.sls b/maas/machines/mark_broken_fixed.sls
45 index 0000000..46691bb
47 +++ b/maas/machines/mark_broken_fixed.sls
49 +##############################################################################
50 +# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
51 +# All rights reserved. This program and the accompanying materials
52 +# are made available under the terms of the Apache License, Version 2.0
53 +# which accompanies this distribution, and is available at
54 +# http://www.apache.org/licenses/LICENSE-2.0
55 +##############################################################################
56 +{%- from "maas/map.jinja" import region with context %}
60 + - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials"
61 + - unless: 'test -e /var/lib/maas/.maas_credentials'
63 +# TODO: implement mark_broken_fixed_machine via _modules/maas.py
64 +mark_broken_fixed_machine:
66 + - 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"
68 + - cmd: maas_login_admin
69 diff --git a/maas/machines/override_failed_testing.sls b/maas/machines/override_failed_testing.sls
71 index 0000000..e7fe1d2
73 +++ b/maas/machines/override_failed_testing.sls
75 +##############################################################################
76 +# Copyright (c) 2018 Mirantis Inc., Enea AB and others.
77 +# All rights reserved. This program and the accompanying materials
78 +# are made available under the terms of the Apache License, Version 2.0
79 +# which accompanies this distribution, and is available at
80 +# http://www.apache.org/licenses/LICENSE-2.0
81 +##############################################################################
82 +{%- from "maas/map.jinja" import region with context %}
86 + - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials"
87 + - unless: 'test -e /var/lib/maas/.maas_credentials'
89 +# TODO: implement override_failed_testing via _modules/maas.py
90 +mark_broken_fixed_machine:
92 + - 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'] }}"
94 + - cmd: maas_login_admin
95 diff --git a/maas/pxe_nat.sls b/maas/pxe_nat.sls
97 index 0000000..8a03c4f
99 +++ b/maas/pxe_nat.sls
101 +##############################################################################
102 +# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
103 +# All rights reserved. This program and the accompanying materials
104 +# are made available under the terms of the Apache License, Version 2.0
105 +# which accompanies this distribution, and is available at
106 +# http://www.apache.org/licenses/LICENSE-2.0
107 +##############################################################################
108 +net.ipv4.ip_forward:
115 + - chain: POSTROUTING
118 + - source: {{ salt['pillar.get']('_param:single_address') }}/{{ salt['pillar.get']('_param:opnfv_net_admin_mask') }}
121 +iptables_pxe_source:
127 + - source: {{ salt['pillar.get']('_param:single_address') }}/{{ salt['pillar.get']('_param:opnfv_net_admin_mask') }}
130 +iptables_pxe_destination:
135 + - destination: {{ salt['pillar.get']('_param:single_address') }}/{{ salt['pillar.get']('_param:opnfv_net_admin_mask') }}