Ondrej Smola | 9af2b08 | 2016-08-25 17:37:29 +0200 | [diff] [blame] | 1 | {%- from "maas/map.jinja" import region with context %} |
Vasyl Saienko | 8784db8 | 2018-07-06 11:15:52 +0300 | [diff] [blame] | 2 | {%- if region.get('enabled', False) %} |
Ondrej Smola | 9af2b08 | 2016-08-25 17:37:29 +0200 | [diff] [blame] | 3 | |
Ondrej Smola | a5844e0 | 2016-08-25 19:06:56 +0200 | [diff] [blame] | 4 | maas_region_packages: |
Ondrej Smola | 9af2b08 | 2016-08-25 17:37:29 +0200 | [diff] [blame] | 5 | pkg.installed: |
| 6 | - names: {{ region.pkgs }} |
| 7 | |
Ondrej Smola | 61a7777 | 2016-08-25 20:05:30 +0200 | [diff] [blame] | 8 | /etc/maas/regiond.conf: |
Ondrej Smola | 9af2b08 | 2016-08-25 17:37:29 +0200 | [diff] [blame] | 9 | file.managed: |
Ondrej Smola | 61a7777 | 2016-08-25 20:05:30 +0200 | [diff] [blame] | 10 | - source: salt://maas/files/regiond.conf |
Ondrej Smola | 9af2b08 | 2016-08-25 17:37:29 +0200 | [diff] [blame] | 11 | - template: jinja |
Alexander Noskov | e24078a | 2017-06-20 12:24:28 +0200 | [diff] [blame] | 12 | - group: maas |
Ondrej Smola | 9af2b08 | 2016-08-25 17:37:29 +0200 | [diff] [blame] | 13 | - require: |
Ondrej Smola | a5844e0 | 2016-08-25 19:06:56 +0200 | [diff] [blame] | 14 | - pkg: maas_region_packages |
Ondrej Smola | 9af2b08 | 2016-08-25 17:37:29 +0200 | [diff] [blame] | 15 | |
Jiri Broulik | 0df14bc | 2017-08-07 10:01:55 +0200 | [diff] [blame] | 16 | /usr/lib/python3/dist-packages/provisioningserver/templates/proxy/maas-proxy.conf.template: |
| 17 | file.managed: |
| 18 | - source: salt://maas/files/maas-proxy.conf.template |
| 19 | - template: jinja |
| 20 | - require: |
| 21 | - pkg: maas_region_packages |
| 22 | |
Martin Polreich | 0764b76 | 2017-11-20 14:08:30 +0100 | [diff] [blame] | 23 | {%- if region.database.initial_data is defined %} |
| 24 | |
| 25 | /root/maas/scripts/restore_{{ region.database.name }}.sh: |
| 26 | file.managed: |
| 27 | - source: salt://maas/files/restore.sh |
| 28 | - mode: 770 |
Jiri Broulik | 47d506b | 2018-04-13 15:50:53 +0200 | [diff] [blame] | 29 | - makedirs: true |
Martin Polreich | 0764b76 | 2017-11-20 14:08:30 +0100 | [diff] [blame] | 30 | - template: jinja |
| 31 | |
| 32 | restore_maas_database_{{ region.database.name }}: |
| 33 | cmd.run: |
| 34 | - name: /root/maas/scripts/restore_{{ region.database.name }}.sh |
| 35 | - unless: "[ -f /root/maas/flags/{{ region.database.name }}-installed ]" |
| 36 | - cwd: /root |
| 37 | - require: |
| 38 | - file: /root/maas/scripts/restore_{{ region.database.name }}.sh |
| 39 | |
| 40 | {%- endif %} |
| 41 | |
Jakub Pavlik | 2bd298f | 2016-08-31 13:50:58 +0200 | [diff] [blame] | 42 | {%- if region.get('enable_iframe', False) %} |
| 43 | |
| 44 | /etc/apache2/conf-enabled/maas-http.conf: |
| 45 | file.managed: |
| 46 | - source: salt://maas/files/maas-http.conf |
| 47 | - user: root |
| 48 | - group: root |
| 49 | - mode: 644 |
| 50 | - require: |
| 51 | - pkg: maas_region_packages |
| 52 | - require_in: |
Pavel Cizinsky | 5a6e272 | 2016-08-31 15:58:13 +0200 | [diff] [blame] | 53 | - service: maas_region_services |
Jakub Pavlik | 2bd298f | 2016-08-31 13:50:58 +0200 | [diff] [blame] | 54 | |
Jakub Pavlik | bb82180 | 2016-08-31 18:14:57 +0200 | [diff] [blame] | 55 | maas_apache_headers: |
| 56 | cmd.run: |
| 57 | - name: "a2enmod headers" |
Jakub Pavlik | 2bd298f | 2016-08-31 13:50:58 +0200 | [diff] [blame] | 58 | - require: |
| 59 | - pkg: maas_region_packages |
| 60 | - require_in: |
Pavel Cizinsky | 5a6e272 | 2016-08-31 15:58:13 +0200 | [diff] [blame] | 61 | - service: maas_region_services |
Jakub Pavlik | 2bd298f | 2016-08-31 13:50:58 +0200 | [diff] [blame] | 62 | |
Pavel Cizinsky | 5a6e272 | 2016-08-31 15:58:13 +0200 | [diff] [blame] | 63 | {%- endif %} |
| 64 | |
| 65 | {% if region.theme is defined %} |
| 66 | |
| 67 | /usr/share/maas/web/static/css/maas-styles.css: |
| 68 | file.managed: |
| 69 | - source: salt://maas/files/{{ region.theme }}-styles.css |
Pavel Cizinsky | 5a6e272 | 2016-08-31 15:58:13 +0200 | [diff] [blame] | 70 | - mode: 644 |
| 71 | - watch_in: |
| 72 | - service: maas_region_services |
| 73 | |
Jakub Pavlik | 2bd298f | 2016-08-31 13:50:58 +0200 | [diff] [blame] | 74 | {%- endif %} |
| 75 | |
Ondrej Smola | 9af2b08 | 2016-08-25 17:37:29 +0200 | [diff] [blame] | 76 | /etc/maas/preseeds/curtin_userdata_amd64_generic_trusty: |
| 77 | file.managed: |
| 78 | - source: salt://maas/files/curtin_userdata_amd64_generic_trusty |
| 79 | - template: jinja |
| 80 | - user: root |
| 81 | - group: root |
| 82 | - mode: 644 |
Damian Szeluga | 732e052 | 2017-03-29 16:53:06 +0200 | [diff] [blame] | 83 | - context: |
| 84 | salt_master_ip: {{ region.salt_master_ip }} |
Ondrej Smola | 9af2b08 | 2016-08-25 17:37:29 +0200 | [diff] [blame] | 85 | - require: |
Ondrej Smola | a5844e0 | 2016-08-25 19:06:56 +0200 | [diff] [blame] | 86 | - pkg: maas_region_packages |
Ondrej Smola | 9af2b08 | 2016-08-25 17:37:29 +0200 | [diff] [blame] | 87 | |
Damian Szeluga | 9fe4ce7 | 2017-03-29 14:27:10 +0200 | [diff] [blame] | 88 | /etc/maas/preseeds/curtin_userdata_amd64_generic_xenial: |
| 89 | file.managed: |
| 90 | - source: salt://maas/files/curtin_userdata_amd64_generic_xenial |
| 91 | - template: jinja |
| 92 | - user: root |
| 93 | - group: root |
| 94 | - mode: 644 |
Damian Szeluga | 732e052 | 2017-03-29 16:53:06 +0200 | [diff] [blame] | 95 | - context: |
| 96 | salt_master_ip: {{ region.salt_master_ip }} |
Damian Szeluga | 9fe4ce7 | 2017-03-29 14:27:10 +0200 | [diff] [blame] | 97 | - require: |
| 98 | - pkg: maas_region_packages |
| 99 | |
Alexandru Avadanii | 7dc29b3 | 2017-08-05 02:03:01 +0200 | [diff] [blame] | 100 | /etc/maas/preseeds/curtin_userdata_arm64_generic_xenial: |
| 101 | file.managed: |
| 102 | - source: salt://maas/files/curtin_userdata_arm64_generic_xenial |
| 103 | - template: jinja |
| 104 | - user: root |
| 105 | - group: root |
| 106 | - mode: 644 |
| 107 | - context: |
| 108 | salt_master_ip: {{ region.salt_master_ip }} |
| 109 | - require: |
| 110 | - pkg: maas_region_packages |
| 111 | |
Petr Michalec | 8a0d52e | 2018-05-30 16:22:56 +0200 | [diff] [blame] | 112 | Configure /root/.pgpass for MAAS: |
Martin Polreich | 1330119 | 2017-11-13 17:51:07 +0100 | [diff] [blame] | 113 | file.managed: |
Petr Michalec | 8a0d52e | 2018-05-30 16:22:56 +0200 | [diff] [blame] | 114 | - name: /root/.pgpass |
Martin Polreich | 1330119 | 2017-11-13 17:51:07 +0100 | [diff] [blame] | 115 | - source: salt://maas/files/pgpass |
| 116 | - template: jinja |
| 117 | - user: root |
| 118 | - group: root |
| 119 | - mode: 600 |
| 120 | |
Jakub Pavlik | d69c6da | 2016-08-29 22:33:53 +0200 | [diff] [blame] | 121 | maas_region_services: |
| 122 | service.running: |
| 123 | - enable: true |
| 124 | - names: {{ region.services }} |
| 125 | - require: |
| 126 | - cmd: maas_region_syncdb |
| 127 | - watch: |
| 128 | - file: /etc/maas/regiond.conf |
Petr Michalec | 8a0d52e | 2018-05-30 16:22:56 +0200 | [diff] [blame] | 129 | {%- if grains.get('kitchen-test') %} |
| 130 | - onlyif: /bin/false |
| 131 | {%- endif %} |
Jakub Pavlik | d69c6da | 2016-08-29 22:33:53 +0200 | [diff] [blame] | 132 | |
| 133 | maas_region_syncdb: |
| 134 | cmd.run: |
| 135 | - names: |
Petr Michalec | 8a0d52e | 2018-05-30 16:22:56 +0200 | [diff] [blame] | 136 | - maas-region syncdb --noinput |
Jakub Pavlik | d69c6da | 2016-08-29 22:33:53 +0200 | [diff] [blame] | 137 | - require: |
| 138 | - file: /etc/maas/regiond.conf |
Petr Michalec | 8a0d52e | 2018-05-30 16:22:56 +0200 | [diff] [blame] | 139 | {%- if grains['saltversioninfo'][0] >= 2017 and grains['saltversioninfo'][1] >= 7 %} |
| 140 | - retry: |
| 141 | attempts: 3 |
| 142 | interval: 5 |
| 143 | splay: 5 |
| 144 | {%- endif %} |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 145 | {%- if grains.get('kitchen-test') %} |
| 146 | - onlyif: /bin/false |
| 147 | {%- endif %} |
Jakub Pavlik | d69c6da | 2016-08-29 22:33:53 +0200 | [diff] [blame] | 148 | |
azvyagintsev | 5894707 | 2018-06-29 12:09:48 +0300 | [diff] [blame] | 149 | maas_warmup: |
| 150 | module.run: |
| 151 | - name: maasng.wait_for_http_code |
azvyagintsev | 5894707 | 2018-06-29 12:09:48 +0300 | [diff] [blame] | 152 | # FIXME |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 153 | - url: "http://localhost:5240/MAAS" |
azvyagintsev | 5894707 | 2018-06-29 12:09:48 +0300 | [diff] [blame] | 154 | # 405 - should be removed ,since twisted will be fixed |
| 155 | # Currently - api always throw 405=>500 even if request has been made with 'expected 'HEAD |
azvyagintsev | 4838126 | 2018-06-29 12:42:20 +0300 | [diff] [blame] | 156 | - expected: [200, 405] |
azvyagintsev | 5894707 | 2018-06-29 12:09:48 +0300 | [diff] [blame] | 157 | - require_in: |
| 158 | - module: maas_set_admin_password |
| 159 | {%- if grains.get('kitchen-test') %} |
| 160 | - onlyif: /bin/false |
| 161 | {%- endif %} |
| 162 | |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 163 | maas_set_admin_password: |
Pavel Cizinsky | 2174e7f | 2016-08-30 18:45:22 +0200 | [diff] [blame] | 164 | cmd.run: |
| 165 | - name: "maas createadmin --username {{ region.admin.username }} --password {{ region.admin.password }} --email {{ region.admin.email }} && touch /var/lib/maas/.setup_admin" |
| 166 | - creates: /var/lib/maas/.setup_admin |
| 167 | - require: |
| 168 | - service: maas_region_services |
Petr Michalec | 8a0d52e | 2018-05-30 16:22:56 +0200 | [diff] [blame] | 169 | {%- if grains.get('kitchen-test') %} |
| 170 | - onlyif: /bin/false |
| 171 | {%- endif %} |
Ondrej Smola | a5844e0 | 2016-08-25 19:06:56 +0200 | [diff] [blame] | 172 | |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 173 | maas_login_admin: |
| 174 | cmd.run: |
| 175 | - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials" |
Petr Michalec | 8a0d52e | 2018-05-30 16:22:56 +0200 | [diff] [blame] | 176 | - require: |
| 177 | - cmd: maas_set_admin_password |
| 178 | {%- if grains.get('kitchen-test') %} |
| 179 | - onlyif: /bin/false |
| 180 | {%- endif %} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 181 | |
azvyagintsev | cb54d14 | 2018-06-19 16:18:32 +0300 | [diff] [blame] | 182 | maas_wait_for_racks_import_done: |
| 183 | module.run: |
| 184 | - name: maasng.sync_and_wait_bs_to_all_racks |
| 185 | - require: |
| 186 | - cmd: maas_login_admin |
| 187 | - require_in: |
| 188 | - module: maas_config |
| 189 | {%- if grains.get('kitchen-test') %} |
| 190 | - onlyif: /bin/false |
| 191 | {%- endif %} |
| 192 | |
| 193 | maas_wait_for_region_import_done: |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 194 | module.run: |
| 195 | - name: maasng.boot_resources_import |
| 196 | - action: 'import' |
| 197 | - wait: True |
| 198 | - require: |
| 199 | - cmd: maas_login_admin |
| 200 | {% if region.get('boot_sources_delete_all_others', False) %} |
| 201 | - module: region_boot_sources_delete_all_others |
| 202 | {%- endif %} |
| 203 | - require_in: |
azvyagintsev | cb54d14 | 2018-06-19 16:18:32 +0300 | [diff] [blame] | 204 | - module: maas_wait_for_racks_import_done |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 205 | {%- if grains.get('kitchen-test') %} |
| 206 | - onlyif: /bin/false |
| 207 | {%- endif %} |
| 208 | |
Krzysztof Szukiełojć | 43bc7e0 | 2017-03-17 10:32:07 +0100 | [diff] [blame] | 209 | maas_config: |
| 210 | module.run: |
| 211 | - name: maas.process_maas_config |
| 212 | - require: |
| 213 | - cmd: maas_login_admin |
Petr Michalec | 8a0d52e | 2018-05-30 16:22:56 +0200 | [diff] [blame] | 214 | {%- if grains.get('kitchen-test') %} |
| 215 | - onlyif: /bin/false |
| 216 | {%- endif %} |
Krzysztof Szukiełojć | 43bc7e0 | 2017-03-17 10:32:07 +0100 | [diff] [blame] | 217 | |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 218 | {##} |
| 219 | {% if region.get('boot_sources_delete_all_others', False) %} |
| 220 | {# Collect exclude list, all other - will be removed #} |
| 221 | {% set exclude_list=[] %} |
| 222 | {%- for _, bs in region.boot_sources.iteritems() %} {% if bs.url is defined %} {% do exclude_list.append(bs.url) %} {% endif %} {%- endfor %} |
| 223 | region_boot_sources_delete_all_others: |
Jiri Broulik | ccccf0a | 2018-04-11 16:49:14 +0200 | [diff] [blame] | 224 | module.run: |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 225 | - name: maasng.boot_sources_delete_all_others |
| 226 | - except_urls: {{ exclude_list }} |
Jiri Broulik | ccccf0a | 2018-04-11 16:49:14 +0200 | [diff] [blame] | 227 | - require: |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 228 | - cmd: maas_login_admin |
Jiri Broulik | ccccf0a | 2018-04-11 16:49:14 +0200 | [diff] [blame] | 229 | {%- endif %} |
| 230 | |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 231 | {##} |
| 232 | {% if region.get('boot_sources', False) %} |
| 233 | {%- for b_name, b_source in region.boot_sources.iteritems() %} |
| 234 | maas_region_boot_source_{{ b_name }}: |
| 235 | maasng.boot_source_present: |
| 236 | - url: {{ b_source.url }} |
| 237 | {%- if b_source.keyring_data is defined %} |
| 238 | - keyring_data: {{ b_source.keyring_data }} |
| 239 | {%- endif %} |
| 240 | {%- if b_source.keyring_file is defined %} |
| 241 | - keyring_file: {{ b_source.keyring_file }} |
| 242 | {%- endif %} |
| 243 | - require: |
| 244 | - cmd: maas_login_admin |
| 245 | {%- endfor %} |
| 246 | {%- endif %} |
| 247 | |
| 248 | {##} |
| 249 | {% if region.get('boot_sources_selections', False) %} |
| 250 | {%- for bs_name, bs_source in region.boot_sources_selections.iteritems() %} |
| 251 | maas_region_boot_sources_selection_{{ bs_name }}: |
| 252 | maasng.boot_sources_selections_present: |
| 253 | - bs_url: {{ bs_source.url }} |
| 254 | - os: {{ bs_source.os }} |
| 255 | - release: {{ bs_source.release|string }} |
| 256 | - arches: {{ bs_source.arches|string }} |
| 257 | - subarches: {{ bs_source.subarches|string }} |
| 258 | - labels: {{ bs_source.labels }} |
| 259 | - require_in: |
| 260 | - module: maas_config |
azvyagintsev | cb54d14 | 2018-06-19 16:18:32 +0300 | [diff] [blame] | 261 | - module: maas_wait_for_racks_import_done |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 262 | - require: |
| 263 | - cmd: maas_login_admin |
| 264 | {% if region.get('boot_sources', False) %} |
| 265 | {%- for b_name, _ in region.boot_sources.iteritems() %} |
| 266 | - maas_region_boot_source_{{ b_name }} |
| 267 | {% endfor %} |
| 268 | {%- endif %} |
| 269 | {%- endfor %} |
| 270 | {%- endif %} |
| 271 | {##} |
| 272 | |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 273 | {%- if region.get('commissioning_scripts', False) %} |
| 274 | /etc/maas/files/commisioning_scripts/: |
| 275 | file.directory: |
| 276 | - user: root |
| 277 | - group: root |
| 278 | - mode: 755 |
| 279 | - makedirs: true |
| 280 | - require: |
| 281 | - pkg: maas_region_packages |
| 282 | |
| 283 | /etc/maas/files/commisioning_scripts/00-maas-05-simplify-network-interfaces: |
| 284 | file.managed: |
| 285 | - source: salt://maas/files/commisioning_scripts/00-maas-05-simplify-network-interfaces |
| 286 | - mode: 755 |
| 287 | - user: root |
| 288 | - group: root |
| 289 | - require: |
| 290 | - file: /etc/maas/files/commisioning_scripts/ |
| 291 | |
Krzysztof Szukiełojć | 43bc7e0 | 2017-03-17 10:32:07 +0100 | [diff] [blame] | 292 | maas_commissioning_scripts: |
| 293 | module.run: |
| 294 | - name: maas.process_commissioning_scripts |
| 295 | - require: |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 296 | - cmd: maas_login_admin |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 297 | {%- endif %} |
Krzysztof Szukiełojć | 43bc7e0 | 2017-03-17 10:32:07 +0100 | [diff] [blame] | 298 | |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 299 | {%- if region.get('fabrics', False) %} |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 300 | {%- for _, fabric in region.fabrics.iteritems() %} |
| 301 | {% set fabric_name=fabric.get('name', _) %} |
| 302 | # First, create fabrics |
| 303 | # Bakward-compat.name: |
| 304 | |
| 305 | maas_fabrics_{{ fabric_name }}: |
| 306 | maasng.fabric_present: |
| 307 | - name: {{ fabric_name }} |
| 308 | - description: {{ fabric.get('description', '') }} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 309 | - require: |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 310 | - cmd: maas_login_admin |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 311 | |
| 312 | # Second, add VLAN into fabric's |
| 313 | {%- for vlan_n, data in fabric.get('vlans',{}).iteritems() %} |
| 314 | maas_vlan{{ vlan_n }}_present_for_{{ fabric_name }}: |
| 315 | maasng.vlan_present_in_fabric: |
| 316 | - vlan: {{ vlan_n }} |
Petr Ruzicka | 8047185 | 2018-07-13 14:08:27 +0200 | [diff] [blame^] | 317 | - mtu: {{ data.get('mtu','') }} |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 318 | - fabric: {{ fabric_name }} |
| 319 | - name: {{ data.get('name','') }} |
| 320 | - description: {{ data.description }} |
| 321 | - primary_rack: {{ data.get('primary_rack', '') }} |
| 322 | {%- endfor %} |
| 323 | {%- endfor %} |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 324 | {%- endif %} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 325 | |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 326 | # Create subnets |
Pavel Cizinsky | 8dd85b5 | 2018-06-18 21:40:13 +0200 | [diff] [blame] | 327 | {%- if region.subnets is defined %} |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 328 | {%- for _, subnet in region.subnets.iteritems() %} |
| 329 | maas_create_subnet_{{ subnet.cidr }}: |
Pavel Cizinsky | 8dd85b5 | 2018-06-18 21:40:13 +0200 | [diff] [blame] | 330 | maasng.subnet_present: |
| 331 | - cidr: {{ subnet.cidr }} |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 332 | - name: {{ subnet.get('name','') }} |
Pavel Cizinsky | 8dd85b5 | 2018-06-18 21:40:13 +0200 | [diff] [blame] | 333 | - fabric: {{ subnet.fabric }} |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 334 | - vlan: {{ subnet.get('vlan','') }} |
Pavel Cizinsky | 8dd85b5 | 2018-06-18 21:40:13 +0200 | [diff] [blame] | 335 | - gateway_ip: {{ subnet.gateway_ip }} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 336 | - require: |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 337 | - cmd: maas_login_admin |
azvyagintsev | 0c62232 | 2017-11-23 12:46:50 +0200 | [diff] [blame] | 338 | {%- if region.get('fabrics', False) %} |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 339 | - maas_fabrics_{{ subnet.fabric }} |
azvyagintsev | 0c62232 | 2017-11-23 12:46:50 +0200 | [diff] [blame] | 340 | {%- endif %} |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 341 | # create ranges |
| 342 | {%- for _r, iprange in subnet.get('ipranges',{}).iteritems() %} |
| 343 | maas_create_iprange_{{ _r }}: |
Pavel Cizinsky | 8dd85b5 | 2018-06-18 21:40:13 +0200 | [diff] [blame] | 344 | maasng.iprange_present: |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 345 | - name: {{ iprange.get('name', _r) }} |
Pavel Cizinsky | 8dd85b5 | 2018-06-18 21:40:13 +0200 | [diff] [blame] | 346 | - type_range: {{ iprange.type }} |
| 347 | - start_ip: {{ iprange.start }} |
| 348 | - end_ip: {{ iprange.end }} |
azvyagintsev | f0904ac | 2018-07-05 18:53:26 +0300 | [diff] [blame] | 349 | - subnet: {{ iprange.get('subnet', '' ) }} |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 350 | - comment: {{ iprange.get('comment', "") }} |
Pavel Cizinsky | 8dd85b5 | 2018-06-18 21:40:13 +0200 | [diff] [blame] | 351 | - require: |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 352 | - maas_create_subnet_{{ subnet.cidr }} |
| 353 | {%- endfor %} |
| 354 | {%- endfor %} |
Pavel Cizinsky | 8dd85b5 | 2018-06-18 21:40:13 +0200 | [diff] [blame] | 355 | {%- endif %} |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 356 | |
| 357 | # Get back to fabrics again and enable DHCP |
| 358 | {%- if region.get('fabrics', False) %} |
| 359 | {%- for _, fabric in region.fabrics.iteritems() %} |
| 360 | {%- for vlan_n, data in fabric.get('vlans',{}).iteritems() %} |
| 361 | {% set fabric_name=fabric.get('name', _) %} |
| 362 | maas_vlan{{ vlan_n }}_present_for_{{ fabric_name }}_dhcp: |
| 363 | maasng.vlan_present_in_fabric: |
| 364 | - vlan: {{ vlan_n }} |
Petr Ruzicka | 8047185 | 2018-07-13 14:08:27 +0200 | [diff] [blame^] | 365 | - mtu: {{ data.get('mtu','') }} |
azvyagintsev | f3515c8 | 2018-06-26 18:59:05 +0300 | [diff] [blame] | 366 | - fabric: {{ fabric_name }} |
| 367 | - name: {{ data.get('name','') }} |
| 368 | - description: {{ data.description }} |
| 369 | - primary_rack: {{ data.get('primary_rack', '') }} |
| 370 | - dhcp_on: {{ data.get('dhcp','False') }} |
| 371 | {%- endfor %} |
| 372 | {%- endfor %} |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 373 | {%- endif %} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 374 | |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 375 | {%- if region.get('devices', False) %} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 376 | maas_devices: |
| 377 | module.run: |
| 378 | - name: maas.process_devices |
| 379 | - require: |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 380 | - cmd: maas_login_admin |
azvyagintsev | 0c62232 | 2017-11-23 12:46:50 +0200 | [diff] [blame] | 381 | {%- if region.get('subnets', False) %} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 382 | - module: maas_subnets |
azvyagintsev | 0c62232 | 2017-11-23 12:46:50 +0200 | [diff] [blame] | 383 | {%- endif %} |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 384 | {%- endif %} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 385 | |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 386 | {%- if region.get('dhcp_snippets', False) %} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 387 | maas_dhcp_snippets: |
| 388 | module.run: |
| 389 | - name: maas.process_dhcp_snippets |
| 390 | - require: |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 391 | - cmd: maas_login_admin |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 392 | {%- endif %} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 393 | |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 394 | {%- if region.get('package_repositories', False) %} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 395 | maas_package_repositories: |
| 396 | module.run: |
| 397 | - name: maas.process_package_repositories |
| 398 | - require: |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 399 | - cmd: maas_login_admin |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 400 | {%- endif %} |
Krzysztof Szukiełojć | c4b3309 | 2017-02-15 13:25:38 +0100 | [diff] [blame] | 401 | |
azvyagintsev | 6913e5e | 2018-07-05 11:42:53 +0300 | [diff] [blame] | 402 | # FIXME |
| 403 | # This function usless since broken API logic in module. |
| 404 | # Should be refactored to be able work with regaiond-domain structure. |
| 405 | #maas_domain: |
| 406 | # module.run: |
| 407 | # - name: maas.process_domain |
| 408 | # - require: |
| 409 | # - cmd: maas_login_admin |
| 410 | # {%- if grains.get('kitchen-test') %} |
| 411 | # - onlyif: /bin/false |
| 412 | # {%- endif %} |
Krzysztof Szukiełojć | 8cc32b4 | 2017-03-29 15:22:57 +0200 | [diff] [blame] | 413 | |
Pavel Cizinsky | 0995e8f | 2018-05-04 17:10:37 +0200 | [diff] [blame] | 414 | |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 415 | {%- if region.get('sshprefs', False) %} |
Krzysztof Szukiełojć | a1bd77e | 2017-03-30 08:34:22 +0200 | [diff] [blame] | 416 | maas_sshprefs: |
| 417 | module.run: |
| 418 | - name: maas.process_sshprefs |
| 419 | - require: |
azvyagintsev | 3ff2ef1 | 2018-06-01 21:30:45 +0300 | [diff] [blame] | 420 | - cmd: maas_login_admin |
azvyagintsev | ec61dd6 | 2017-11-16 19:12:05 +0200 | [diff] [blame] | 421 | {%- endif %} |
Krzysztof Szukiełojć | a1bd77e | 2017-03-30 08:34:22 +0200 | [diff] [blame] | 422 | |
Jakub Pavlik | 2bd298f | 2016-08-31 13:50:58 +0200 | [diff] [blame] | 423 | {%- endif %} |