Refactor collection
This commit is contained in:
parent
39dcd749a0
commit
f615c00fdb
17 changed files with 44 additions and 39 deletions
|
@ -1,6 +1,6 @@
|
||||||
- name: Burn img to device
|
- name: Burn img to device
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: dd if="{{ dietpi_img}}.img" of="{{ dietpi_device }}" bs=4M status=progress
|
cmd: dd if="{{ dietpi.img}}.img" of="{{ dietpi_device }}" bs=4M status=progress
|
||||||
chdir: "{{ build_dir.path }}"
|
chdir: "{{ build_dir.path }}"
|
||||||
become: true
|
become: true
|
||||||
register: cmd_result
|
register: cmd_result
|
9
sbc/roles/dietpi_install/tasks/download_iso.yml
Normal file
9
sbc/roles/dietpi_install/tasks/download_iso.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
- name: Download iso
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: "{{ dietpi_download_base }}/{{ dietpi.img }}.7z"
|
||||||
|
dest: "{{ (lookup('ansible.builtin.env', 'XDG_RUNTIME_DIR'), dietpi.img + '.xz') | path_join }}"
|
||||||
|
- name: Extract iso
|
||||||
|
ansible.builtin.command:
|
||||||
|
#cmd: 7z x -y -o"{{ build_dir.path }}" "{{ (lookup('ansible.builtin.env', 'XDG_RUNTIME_DIR'), dietpi.img + '.7z') | path_join }}"
|
||||||
|
cmd: xz -d "{{ (lookup('ansible.builtin.env', 'XDG_RUNTIME_DIR'), dietpi.img + '.xz') | path_join }}"
|
||||||
|
|
|
@ -2,5 +2,7 @@
|
||||||
- import_tasks: prepare_facts.yml
|
- import_tasks: prepare_facts.yml
|
||||||
- import_tasks: prepare_directory.yml
|
- import_tasks: prepare_directory.yml
|
||||||
- import_tasks: download_iso.yml
|
- import_tasks: download_iso.yml
|
||||||
|
when: dietpi_reconfig is undefined or not dietpi_reconfig
|
||||||
- import_tasks: burn_to_device.yml
|
- import_tasks: burn_to_device.yml
|
||||||
|
when: dietpi_reconfig is undefined or not dietpi_reconfig
|
||||||
- import_tasks: template_configs.yml
|
- import_tasks: template_configs.yml
|
|
@ -2,9 +2,11 @@
|
||||||
ansible.builtin.pause:
|
ansible.builtin.pause:
|
||||||
prompt: "Input device to install dietpi on"
|
prompt: "Input device to install dietpi on"
|
||||||
register: dietpi_device_prompt
|
register: dietpi_device_prompt
|
||||||
|
when: dietpi_device is undefined
|
||||||
- name: Set dietpi_device
|
- name: Set dietpi_device
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
dietpi_device: "{{ dietpi_device_prompt.user_input }}"
|
dietpi_device: "{{ dietpi_device_prompt.user_input }}"
|
||||||
|
when: dietpi_device is undefined
|
||||||
- name: Check dietpi device
|
- name: Check dietpi device
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: test -b {{ dietpi_device }}
|
cmd: test -b {{ dietpi_device }}
|
|
@ -29,7 +29,7 @@
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: dietpi-wifi.txt.j2
|
src: dietpi-wifi.txt.j2
|
||||||
dest: "{{ (config_path, 'dietpi-wifi.txt') | path_join }}"
|
dest: "{{ (config_path, 'dietpi-wifi.txt') | path_join }}"
|
||||||
when: wifi_enabled | default(False)
|
when: dietpi.auto_setup.net_wifi_enabled | default(False)
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Try to copy Automation_Custom_Script.sh
|
- name: Try to copy Automation_Custom_Script.sh
|
24
sbc/roles/dietpi_install/templates/dietpi-wifi.txt.j2
Normal file
24
sbc/roles/dietpi_install/templates/dietpi-wifi.txt.j2
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{% for wifi in dietpi.wifi %}
|
||||||
|
#---------------------------------------------------------------
|
||||||
|
# Entry {{ loop.index }}
|
||||||
|
# - WiFi SSID: required, case sensitive
|
||||||
|
aWIFI_SSID[{{ loop.index }}]='{{ wifi.ssid }}'
|
||||||
|
# - WiFi key: If no key/open, leave this blank
|
||||||
|
# - In case of WPA-PSK, alternatively enter the 64-digit hexadecimal key returned by wpa_passphrase
|
||||||
|
# - Please replace single quote characters ' in your key with '\''. No other escaping is required.
|
||||||
|
aWIFI_KEY[{{ loop.index }}]='{{ wifi.key|default('') }}'
|
||||||
|
# - Key type: NONE (no key/open) | WPA-PSK | WEP | WPA-EAP (then use settings below)
|
||||||
|
aWIFI_KEYMGR[{{ loop.index }}]='{{ wifi.keymgr|default('NONE') }}'
|
||||||
|
# - WPA-EAP options: Only fill if WPA-EAP is set above
|
||||||
|
aWIFI_PROTO[{{ loop.index }}]='{{ wifi.proto|default('') }}'
|
||||||
|
aWIFI_PAIRWISE[{{ loop.index }}]='{{ wifi.pairwise|default('') }}'
|
||||||
|
aWIFI_AUTH_ALG[{{ loop.index }}]='{{ wifi.auth_alg|default('') }}'
|
||||||
|
aWIFI_EAP[{{ loop.index }}]='{{ wifi.eap|default('') }}'
|
||||||
|
aWIFI_IDENTITY[{{ loop.index }}]='{{ wifi.identity|default('') }}'
|
||||||
|
aWIFI_PASSWORD[{{ loop.index }}]='{{ wifi.password|default('') }}'
|
||||||
|
aWIFI_PHASE1[{{ loop.index }}]='{{ wifi.phase1|default('') }}'
|
||||||
|
aWIFI_PHASE2[{{ loop.index }}]='{{ wifi.phase2|default('') }}'
|
||||||
|
# - Path to the certificate file, e.g.: /boot/mycert.cer
|
||||||
|
aWIFI_CERT[{{ loop.index }}]='{{ wifi.cert|default('') }}'
|
||||||
|
{% endfor %}
|
||||||
|
#---------------------------------------------------------------
|
|
@ -196,7 +196,7 @@ CONFIG_CHECK_APT_UPDATES={{ diet.config.check_apt_updates|default(1) }}
|
||||||
CONFIG_NTP_MODE={{ diet.config.ntp_mode|default(2) }}
|
CONFIG_NTP_MODE={{ diet.config.ntp_mode|default(2) }}
|
||||||
|
|
||||||
# Serial Console: Set to 0 if you do not require serial console.
|
# Serial Console: Set to 0 if you do not require serial console.
|
||||||
CONFIG_SERIAL_CONSOLE_ENABLE={{ diet.config.serial_console_enable|default(1) }}
|
CONFIG_SERIAL_CONSOLE_ENABLE={{ diet.config.serial_console_enable|default(true) | ternary(1, 0) }}
|
||||||
|
|
||||||
# Sound card
|
# Sound card
|
||||||
CONFIG_SOUNDCARD={{ diet.config.soundcard|default('none') }}
|
CONFIG_SOUNDCARD={{ diet.config.soundcard|default('none') }}
|
||||||
|
@ -206,7 +206,7 @@ CONFIG_SOUNDCARD={{ diet.config.soundcard|default('none') }}
|
||||||
CONFIG_LCDPANEL={{ diet.config.lcdpanel|default('none') }}
|
CONFIG_LCDPANEL={{ diet.config.lcdpanel|default('none') }}
|
||||||
|
|
||||||
# IPv6
|
# IPv6
|
||||||
CONFIG_ENABLE_IPV6={{ diet.config.enable_ipv6|default(true)| ternary(1, 0) }}
|
CONFIG_ENABLE_IPV6={{ diet.config.enable_ipv6|default(true) | ternary(1, 0) }}
|
||||||
|
|
||||||
# APT mirrors which are applied to /etc/apt/sources.list | Values here will also be applied during 1st run setup
|
# APT mirrors which are applied to /etc/apt/sources.list | Values here will also be applied during 1st run setup
|
||||||
# - Raspbian: https://www.raspbian.org/RaspbianMirrors
|
# - Raspbian: https://www.raspbian.org/RaspbianMirrors
|
||||||
|
@ -227,14 +227,14 @@ CONFIG_NTP_MIRROR={{ diet.config.ntp_mirror|default('debian.pool.ntp.org') }}
|
||||||
# 0=Allow password logins for all users, including root
|
# 0=Allow password logins for all users, including root
|
||||||
# root=Disable password login for root user only
|
# root=Disable password login for root user only
|
||||||
# 1=Disable password logins for all users, assure that you have a valid SSH key applied!
|
# 1=Disable password logins for all users, assure that you have a valid SSH key applied!
|
||||||
SOFTWARE_DISABLE_SSH_PASSWORD_LOGINS={{ diet.software.disable_ssh_password_logins|default(false)| ternary(1, 0) }}
|
SOFTWARE_DISABLE_SSH_PASSWORD_LOGINS={{ diet.software.disable_ssh_password_logins|default(false) | ternary(1, 0) }}
|
||||||
|
|
||||||
# VNC Server
|
# VNC Server
|
||||||
SOFTWARE_VNCSERVER_WIDTH={{ diet.software.vncserver_width|default(1280) }}
|
SOFTWARE_VNCSERVER_WIDTH={{ diet.software.vncserver_width|default(1280) }}
|
||||||
SOFTWARE_VNCSERVER_HEIGHT={{ diet.software.vncserver_height|default(720) }}
|
SOFTWARE_VNCSERVER_HEIGHT={{ diet.software.vncserver_height|default(720) }}
|
||||||
SOFTWARE_VNCSERVER_DEPTH={{ diet.software.vncserver_depth|default(16) }}
|
SOFTWARE_VNCSERVER_DEPTH={{ diet.software.vncserver_depth|default(16) }}
|
||||||
SOFTWARE_VNCSERVER_DISPLAY_INDEX={{ diet.software.vncserver_display_index|default(1) }}
|
SOFTWARE_VNCSERVER_DISPLAY_INDEX={{ diet.software.vncserver_display_index|default(1) }}
|
||||||
SOFTWARE_VNCSERVER_SHARE_DESKTOP={{ diet.software.vncserver_share_desktop|default(false)| ternary(1, 0) }}
|
SOFTWARE_VNCSERVER_SHARE_DESKTOP={{ diet.software.vncserver_share_desktop|default(false) | ternary(1, 0) }}
|
||||||
|
|
||||||
# ownCloud/Nextcloud
|
# ownCloud/Nextcloud
|
||||||
# - Optional username for admin account, the default is 'admin', applied during install
|
# - Optional username for admin account, the default is 'admin', applied during install
|
||||||
|
@ -282,7 +282,7 @@ SOFTWARE_K3S_EXEC={{ diet.software.k3s_exec|default('') }}
|
||||||
# - Nightly = Use unstable version DietPi-Dashboard. Might have bugs, but will probably have more features.
|
# - Nightly = Use unstable version DietPi-Dashboard. Might have bugs, but will probably have more features.
|
||||||
SOFTWARE_DIETPI_DASHBOARD_VERSION={{ diet.software.dietpi_dashboard_version|default('Stable') }}
|
SOFTWARE_DIETPI_DASHBOARD_VERSION={{ diet.software.dietpi_dashboard_version|default('Stable') }}
|
||||||
# Whether to only install backend or not
|
# Whether to only install backend or not
|
||||||
SOFTWARE_DIETPI_DASHBOARD_BACKEND={{ diet.software.dietpi_dashboard_backend|default(false)| ternary(1, 0) }}
|
SOFTWARE_DIETPI_DASHBOARD_BACKEND={{ diet.software.dietpi_dashboard_backend|default(false) | ternary(1, 0) }}
|
||||||
|
|
||||||
# PiVPN
|
# PiVPN
|
||||||
# - For an unattended install, place a config file named "unattended_pivpn.conf" into the boot partition/directory.
|
# - For an unattended install, place a config file named "unattended_pivpn.conf" into the boot partition/directory.
|
|
@ -1,8 +0,0 @@
|
||||||
- name: Download iso
|
|
||||||
ansible.builtin.get_url:
|
|
||||||
url: "{{ dietpi_download_base }}/{{ dietpi_img }}.7z"
|
|
||||||
dest: "{{ (lookup('ansible.builtin.env', 'XDG_RUNTIME_DIR'), dietpi_img + '.7z') | path_join }}"
|
|
||||||
- name: Extract iso
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: 7z x -y -o"{{ build_dir.path }}" "{{ (lookup('ansible.builtin.env', 'XDG_RUNTIME_DIR'), dietpi_img + '.7z') | path_join }}"
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
{% foreach dietpi.wifi as index => wifi %}
|
|
||||||
#---------------------------------------------------------------
|
|
||||||
# Entry {{ index }}
|
|
||||||
# - WiFi SSID: required, case sensitive
|
|
||||||
aWIFI_SSID[{{ index }}]='{{ wifi.ssid }}'
|
|
||||||
# - WiFi key: If no key/open, leave this blank
|
|
||||||
# - In case of WPA-PSK, alternatively enter the 64-digit hexadecimal key returned by wpa_passphrase
|
|
||||||
# - Please replace single quote characters ' in your key with '\''. No other escaping is required.
|
|
||||||
aWIFI_KEY[{{ index }}]='{{ wifi.key|default('') }}'
|
|
||||||
# - Key type: NONE (no key/open) | WPA-PSK | WEP | WPA-EAP (then use settings below)
|
|
||||||
aWIFI_KEYMGR[{{ index }}]='{{ wifi.keymgr|default('NONE') }}'
|
|
||||||
# - WPA-EAP options: Only fill if WPA-EAP is set above
|
|
||||||
aWIFI_PROTO[{{ index }}]='{{ wifi.proto|default('') }}'
|
|
||||||
aWIFI_PAIRWISE[{{ index }}]='{{ wifi.pairwise|default('') }}'
|
|
||||||
aWIFI_AUTH_ALG[{{ index }}]='{{ wifi.auth_alg|default('') }}'
|
|
||||||
aWIFI_EAP[{{ index }}]='{{ wifi.eap|default('') }}'
|
|
||||||
aWIFI_IDENTITY[{{ index }}]='{{ wifi.identity|default('') }}'
|
|
||||||
aWIFI_PASSWORD[{{ index }}]='{{ wifi.password|default('') }}'
|
|
||||||
aWIFI_PHASE1[{{ index }}]='{{ wifi.phase1|default('') }}'
|
|
||||||
aWIFI_PHASE2[{{ index }}]='{{ wifi.phase2|default('') }}'
|
|
||||||
# - Path to the certificate file, e.g.: /boot/mycert.cer
|
|
||||||
aWIFI_CERT[{{ index }}]='{{ wifi.cert|default('') }}'
|
|
||||||
{% endforeach %}
|
|
||||||
#---------------------------------------------------------------
|
|
Loading…
Reference in a new issue