refactor: trim bootstrap OS support to core three distro families
This commit is contained in:
@@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Bootstrap Alpine Linux
|
|
||||||
vars:
|
|
||||||
_config: "{{ lookup('vars', bootstrap_var_key) }}"
|
|
||||||
_base_packages: "{{ _config.base | join(' ') }}"
|
|
||||||
_extra_packages: >-
|
|
||||||
{{
|
|
||||||
((_config.extra | default([])) + (_config.conditional | default([])))
|
|
||||||
| reject('equalto', '')
|
|
||||||
| join(' ')
|
|
||||||
}}
|
|
||||||
block:
|
|
||||||
- name: Install Alpine Linux base
|
|
||||||
ansible.builtin.command: >
|
|
||||||
apk --root /mnt --no-cache add {{ _base_packages }}
|
|
||||||
register: bootstrap_alpine_bootstrap_result
|
|
||||||
changed_when: bootstrap_alpine_bootstrap_result.rc == 0
|
|
||||||
|
|
||||||
- name: Install extra packages
|
|
||||||
when: _extra_packages | trim | length > 0
|
|
||||||
ansible.builtin.command: >
|
|
||||||
apk --root /mnt add {{ _extra_packages }}
|
|
||||||
register: bootstrap_alpine_extra_result
|
|
||||||
changed_when: bootstrap_alpine_extra_result.rc == 0
|
|
||||||
|
|
||||||
- name: Install bootloader
|
|
||||||
ansible.builtin.command: >
|
|
||||||
apk --root /mnt add grub grub-efi efibootmgr
|
|
||||||
register: bootstrap_alpine_bootloader_result
|
|
||||||
changed_when: bootstrap_alpine_bootloader_result.rc == 0
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Bootstrap openSUSE
|
|
||||||
vars:
|
|
||||||
_config: "{{ lookup('vars', bootstrap_var_key) }}"
|
|
||||||
_base_patterns: "{{ _config.base | join(' ') }}"
|
|
||||||
_extra_packages: >-
|
|
||||||
{{
|
|
||||||
((_config.extra | default([])) + (_config.conditional | default([])))
|
|
||||||
| reject('equalto', '')
|
|
||||||
| join(' ')
|
|
||||||
}}
|
|
||||||
block:
|
|
||||||
- name: Install openSUSE base patterns
|
|
||||||
ansible.builtin.command: >
|
|
||||||
zypper --root /mnt --non-interactive install -t pattern {{ _base_patterns }}
|
|
||||||
register: bootstrap_opensuse_base_result
|
|
||||||
changed_when: bootstrap_opensuse_base_result.rc == 0
|
|
||||||
|
|
||||||
- name: Install extra packages
|
|
||||||
when: _extra_packages | trim | length > 0
|
|
||||||
ansible.builtin.command: >
|
|
||||||
zypper --root /mnt --non-interactive install {{ _extra_packages }}
|
|
||||||
register: bootstrap_opensuse_extra_result
|
|
||||||
changed_when: bootstrap_opensuse_extra_result.rc == 0
|
|
||||||
|
|
||||||
- name: Install bootloader
|
|
||||||
ansible.builtin.command: >
|
|
||||||
zypper --root /mnt --non-interactive install grub2 grub2-efi efibootmgr
|
|
||||||
register: bootstrap_opensuse_bootloader_result
|
|
||||||
changed_when: bootstrap_opensuse_bootloader_result.rc == 0
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Bootstrap Void Linux
|
|
||||||
vars:
|
|
||||||
_config: "{{ lookup('vars', bootstrap_var_key) }}"
|
|
||||||
_base_packages: "{{ _config.base | join(' ') }}"
|
|
||||||
_extra_packages: >-
|
|
||||||
{{
|
|
||||||
((_config.extra | default([])) + (_config.conditional | default([])))
|
|
||||||
| reject('equalto', '')
|
|
||||||
| join(' ')
|
|
||||||
}}
|
|
||||||
block:
|
|
||||||
- name: Install Void Linux base
|
|
||||||
ansible.builtin.command: >
|
|
||||||
xbps-install -Sy -r /mnt -R https://repo-default.voidlinux.org/current {{ _base_packages }}
|
|
||||||
register: bootstrap_void_base_result
|
|
||||||
changed_when: bootstrap_void_base_result.rc == 0
|
|
||||||
|
|
||||||
- name: Install extra packages
|
|
||||||
when: _extra_packages | trim | length > 0
|
|
||||||
ansible.builtin.command: >
|
|
||||||
xbps-install -Su -r /mnt {{ _extra_packages }}
|
|
||||||
register: bootstrap_void_extra_result
|
|
||||||
changed_when: bootstrap_void_extra_result.rc == 0
|
|
||||||
|
|
||||||
- name: Install bootloader
|
|
||||||
ansible.builtin.command: >
|
|
||||||
xbps-install -Sy -r /mnt grub-x86_64-efi efibootmgr
|
|
||||||
register: bootstrap_void_bootloader_result
|
|
||||||
changed_when: bootstrap_void_bootloader_result.rc == 0
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Write Alpine network interfaces
|
|
||||||
ansible.builtin.copy:
|
|
||||||
dest: /mnt/etc/network/interfaces
|
|
||||||
mode: "0644"
|
|
||||||
content: |
|
|
||||||
auto lo
|
|
||||||
iface lo inet loopback
|
|
||||||
{% for iface in system_cfg.network.interfaces %}
|
|
||||||
{% set inv_name = iface.name | default('') | string %}
|
|
||||||
{% set det_name = configuration_detected_interfaces[loop.index0] | default('eth' ~ loop.index0) %}
|
|
||||||
{% set iface_name = inv_name if inv_name | length > 0 else det_name %}
|
|
||||||
{% set has_static = (iface.ip | default('') | string | length) > 0 %}
|
|
||||||
|
|
||||||
auto {{ iface_name }}
|
|
||||||
iface {{ iface_name }} inet {{ 'static' if has_static else 'dhcp' }}
|
|
||||||
{% if has_static %}
|
|
||||||
address {{ iface.ip }}/{{ iface.prefix }}
|
|
||||||
{% if iface.gateway | default('') | string | length %}
|
|
||||||
gateway {{ iface.gateway }}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
- name: Set Alpine DNS resolvers
|
|
||||||
when: configuration_dns_list | length > 0 or configuration_dns_search | length > 0
|
|
||||||
ansible.builtin.copy:
|
|
||||||
dest: /mnt/etc/resolv.conf
|
|
||||||
mode: "0644"
|
|
||||||
content: |
|
|
||||||
{% if configuration_dns_search | length > 0 %}
|
|
||||||
search {{ configuration_dns_search | join(' ') }}
|
|
||||||
{% endif %}
|
|
||||||
{% for resolver in configuration_dns_list %}
|
|
||||||
nameserver {{ resolver }}
|
|
||||||
{% endfor %}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Write dhcpcd configuration
|
|
||||||
ansible.builtin.copy:
|
|
||||||
dest: /mnt/etc/dhcpcd.conf
|
|
||||||
mode: "0644"
|
|
||||||
content: |
|
|
||||||
{% for iface in system_cfg.network.interfaces %}
|
|
||||||
{% set inv_name = iface.name | default('') | string %}
|
|
||||||
{% set det_name = configuration_detected_interfaces[loop.index0] | default('eth' ~ loop.index0) %}
|
|
||||||
{% set iface_name = inv_name if inv_name | length > 0 else det_name %}
|
|
||||||
{% set has_static = (iface.ip | default('') | string | length) > 0 %}
|
|
||||||
{% if has_static %}
|
|
||||||
interface {{ iface_name }}
|
|
||||||
static ip_address={{ iface.ip }}/{{ iface.prefix }}
|
|
||||||
{% if iface.gateway | default('') | string | length %}
|
|
||||||
static routers={{ iface.gateway }}
|
|
||||||
{% endif %}
|
|
||||||
{% if loop.index0 == 0 and configuration_dns_list | length > 0 %}
|
|
||||||
static domain_name_servers={{ configuration_dns_list | join(' ') }}
|
|
||||||
{% endif %}
|
|
||||||
{% if loop.index0 == 0 and configuration_dns_search | length > 0 %}
|
|
||||||
static domain_search={{ configuration_dns_search | join(' ') }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
Reference in New Issue
Block a user