commit 4525a28eb6b15b5b39fcb25156622b1a3cc200d1 Author: Tobias Reisinger Date: Mon Jul 10 13:28:44 2023 +0200 Init diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/serguzim/sbc/README.md b/serguzim/sbc/README.md new file mode 100644 index 0000000..36405c9 --- /dev/null +++ b/serguzim/sbc/README.md @@ -0,0 +1,3 @@ +# Ansible Collection - serguzim.sbc + +Documentation for the collection. diff --git a/serguzim/sbc/galaxy.yml b/serguzim/sbc/galaxy.yml new file mode 100644 index 0000000..97a5cd5 --- /dev/null +++ b/serguzim/sbc/galaxy.yml @@ -0,0 +1,16 @@ +namespace: serguzim +name: sbc +version: 1.0.0 +readme: README.md +authors: +- Tobias Reisinger +description: a collection with roles for Singe Board Computers, like the RaspberryPi +license: +- AGPL-3.0-or-later +tags: [] +dependencies: {} +repository: https://git.serguzim.me/serguzim/ansible-collection +documentation: https://git.serguzim.me/serguzim/ansible-collection +homepage: https://git.serguzim.me/serguzim/ansible-collection +issues: https://git.serguzim.me/serguzim/ansible-collection/issues +build_ignore: [] diff --git a/serguzim/sbc/meta/runtime.yml b/serguzim/sbc/meta/runtime.yml new file mode 100644 index 0000000..20f709e --- /dev/null +++ b/serguzim/sbc/meta/runtime.yml @@ -0,0 +1,52 @@ +--- +# Collections must specify a minimum required ansible version to upload +# to galaxy +# requires_ansible: '>=2.9.10' + +# Content that Ansible needs to load from another location or that has +# been deprecated/removed +# plugin_routing: +# action: +# redirected_plugin_name: +# redirect: ns.col.new_location +# deprecated_plugin_name: +# deprecation: +# removal_version: "4.0.0" +# warning_text: | +# See the porting guide on how to update your playbook to +# use ns.col.another_plugin instead. +# removed_plugin_name: +# tombstone: +# removal_version: "2.0.0" +# warning_text: | +# See the porting guide on how to update your playbook to +# use ns.col.another_plugin instead. +# become: +# cache: +# callback: +# cliconf: +# connection: +# doc_fragments: +# filter: +# httpapi: +# inventory: +# lookup: +# module_utils: +# modules: +# netconf: +# shell: +# strategy: +# terminal: +# test: +# vars: + +# Python import statements that Ansible needs to load from another location +# import_redirection: +# ansible_collections.ns.col.plugins.module_utils.old_location: +# redirect: ansible_collections.ns.col.plugins.module_utils.new_location + +# Groups of actions/modules that take a common set of options +# action_groups: +# group_name: +# - module1 +# - module2 diff --git a/serguzim/sbc/plugins/README.md b/serguzim/sbc/plugins/README.md new file mode 100644 index 0000000..6260634 --- /dev/null +++ b/serguzim/sbc/plugins/README.md @@ -0,0 +1,31 @@ +# Collections Plugins Directory + +This directory can be used to ship various plugins inside an Ansible collection. Each plugin is placed in a folder that +is named after the type of plugin it is in. It can also include the `module_utils` and `modules` directory that +would contain module utils and modules respectively. + +Here is an example directory of the majority of plugins currently supported by Ansible: + +``` +└── plugins + ├── action + ├── become + ├── cache + ├── callback + ├── cliconf + ├── connection + ├── filter + ├── httpapi + ├── inventory + ├── lookup + ├── module_utils + ├── modules + ├── netconf + ├── shell + ├── strategy + ├── terminal + ├── test + └── vars +``` + +A full list of plugin types can be found at [Working With Plugins](https://docs.ansible.com/ansible-core/2.15/plugins/plugins.html). diff --git a/serguzim/sbc/roles/dietpi-install/tasks/burn-to-device.yml b/serguzim/sbc/roles/dietpi-install/tasks/burn-to-device.yml new file mode 100644 index 0000000..93966eb --- /dev/null +++ b/serguzim/sbc/roles/dietpi-install/tasks/burn-to-device.yml @@ -0,0 +1,10 @@ +- name: Burn img to device + ansible.builtin.command: + cmd: dd if="{{ dietpi_img}}.img" of="{{ dietpi_device }}" bs=4M status=progress + chdir: "{{ build_dir.path }}" + become: true + register: cmd_result + +- name: Debug dd result + ansible.builtin.debug: + var: cmd_result diff --git a/serguzim/sbc/roles/dietpi-install/tasks/copy-automation-script.yml b/serguzim/sbc/roles/dietpi-install/tasks/copy-automation-script.yml new file mode 100644 index 0000000..b5da67e --- /dev/null +++ b/serguzim/sbc/roles/dietpi-install/tasks/copy-automation-script.yml @@ -0,0 +1,25 @@ +--- +- name: Set default path to place configs + ansible.builtin.set_fact: + config_path: "{{ (build_dir.path, 'mount') | path_join }}" +- name: Check if dietpi.txt exists in root + ansible.builtin.stat: + path: "{{ (config_path, 'dietpi.txt') | path_join }}" + register: dietpi_config_file +- name: Set config path into boot directory + ansible.builtin.set_fact: + config_path: "{{ (config_path, 'boot') | path_join }}" + when: not dietpi_config_file.stat.exists + + +- name: Template dietpi.txt + ansible.builtin.template: + src: dietpi.txt.j2 + dest: "{{ (config_path, 'dietpi.txt') | path_join }}" + become: true +- name: Template dietpi-wifi.txt + ansible.builtin.template: + src: dietpi-wifi.txt.j2 + dest: "{{ (config_path, 'dietpi-wifi.txt') | path_join }}" + when: wifi_enabled | default(False) + become: true diff --git a/serguzim/sbc/roles/dietpi-install/tasks/download-iso.yml b/serguzim/sbc/roles/dietpi-install/tasks/download-iso.yml new file mode 100644 index 0000000..46712b3 --- /dev/null +++ b/serguzim/sbc/roles/dietpi-install/tasks/download-iso.yml @@ -0,0 +1,8 @@ +- 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 }}" + diff --git a/serguzim/sbc/roles/dietpi-install/tasks/main.yml b/serguzim/sbc/roles/dietpi-install/tasks/main.yml new file mode 100644 index 0000000..e2ff878 --- /dev/null +++ b/serguzim/sbc/roles/dietpi-install/tasks/main.yml @@ -0,0 +1,6 @@ +--- +- import_tasks: prepare-facts.yml +- import_tasks: prepare-directory.yml +- import_tasks: download-iso.yml +- import_tasks: burn-to-device.yml +- import_tasks: template-configs.yml diff --git a/serguzim/sbc/roles/dietpi-install/tasks/prepare-directory.yml b/serguzim/sbc/roles/dietpi-install/tasks/prepare-directory.yml new file mode 100644 index 0000000..73eaa8d --- /dev/null +++ b/serguzim/sbc/roles/dietpi-install/tasks/prepare-directory.yml @@ -0,0 +1,14 @@ +- name: Create temporary build directory + ansible.builtin.tempfile: + state: directory + suffix: -emgauwa-system + register: build_dir +- name: Print tmp path to user + ansible.builtin.debug: + var: build_dir.path + +- name: Create mount dir in build directory + ansible.builtin.file: + path: "{{ (build_dir.path, 'mount') | path_join }}" + state: directory + mode: '0755' diff --git a/serguzim/sbc/roles/dietpi-install/tasks/prepare-facts.yml b/serguzim/sbc/roles/dietpi-install/tasks/prepare-facts.yml new file mode 100644 index 0000000..e74e9d0 --- /dev/null +++ b/serguzim/sbc/roles/dietpi-install/tasks/prepare-facts.yml @@ -0,0 +1,11 @@ +- name: Prompt for device to install on + ansible.builtin.pause: + prompt: "Input device to install dietpi on" + register: dietpi_device_prompt +- name: Set dietpi_device + ansible.builtin.set_fact: + dietpi_device: "{{ dietpi_device_prompt.user_input }}" +- name: Check dietpi device + ansible.builtin.command: + cmd: test -b {{ dietpi_device }} + changed_when: false diff --git a/serguzim/sbc/roles/dietpi-install/tasks/template-configs.yml b/serguzim/sbc/roles/dietpi-install/tasks/template-configs.yml new file mode 100644 index 0000000..b5078e2 --- /dev/null +++ b/serguzim/sbc/roles/dietpi-install/tasks/template-configs.yml @@ -0,0 +1,50 @@ +--- +- name: Mount the boot directory + ansible.posix.mount: + src: "{{ dietpi_device }}1" + path: "{{ (build_dir.path, 'mount') | path_join }}" + fstype: auto + state: ephemeral + become: true + +- name: Set default path to place configs + ansible.builtin.set_fact: + config_path: "{{ (build_dir.path, 'mount') | path_join }}" +- name: Check if dietpi.txt exists in root + ansible.builtin.stat: + path: "{{ (config_path, 'dietpi.txt') | path_join }}" + register: dietpi_config_file +- name: Set config path into boot directory + ansible.builtin.set_fact: + config_path: "{{ (config_path, 'boot') | path_join }}" + when: not dietpi_config_file.stat.exists + + +- name: Template dietpi.txt + ansible.builtin.template: + src: dietpi.txt.j2 + dest: "{{ (config_path, 'dietpi.txt') | path_join }}" + become: true +- name: Template dietpi-wifi.txt + ansible.builtin.template: + src: dietpi-wifi.txt.j2 + dest: "{{ (config_path, 'dietpi-wifi.txt') | path_join }}" + when: wifi_enabled | default(False) + become: true + +- name: Try to copy Automation_Custom_Script.sh + ansible.builtin.copy: + src: Automation_Custom_Script.sh + dest: "{{ (config_path, 'Automation_Custom_Script.sh') | path_join }}" + ignore_errors: true +- name: Try to template Automation_Custom_Script.sh + ansible.builtin.template: + src: Automation_Custom_Script.sh.j2 + dest: "{{ (config_path, 'Automation_Custom_Script.sh') | path_join }}" + ignore_errors: true + +- name: Unmount the boot directory + ansible.posix.mount: + path: "{{ (build_dir.path, 'mount') | path_join }}" + state: unmounted + become: true diff --git a/serguzim/sbc/roles/dietpi-install/templates/dietpi-wifi.txt.j2 b/serguzim/sbc/roles/dietpi-install/templates/dietpi-wifi.txt.j2 new file mode 100644 index 0000000..a7c4ffb --- /dev/null +++ b/serguzim/sbc/roles/dietpi-install/templates/dietpi-wifi.txt.j2 @@ -0,0 +1,24 @@ +{% 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 %} +#--------------------------------------------------------------- diff --git a/serguzim/sbc/roles/dietpi-install/templates/dietpi.txt.j2 b/serguzim/sbc/roles/dietpi-install/templates/dietpi.txt.j2 new file mode 100644 index 0000000..2fb28df --- /dev/null +++ b/serguzim/sbc/roles/dietpi-install/templates/dietpi.txt.j2 @@ -0,0 +1,307 @@ +# IMPORTANT: +# - This is intended for advanced users, unless you know what you are doing, do not edit this file. Please use the DietPi programs instead. +# - Do not remove uncommented lines, as the items are scraped by DietPi programs, on demand. + +#------------------------------------------------------------------------------------------------------ +##### DietPi-Automation settings, applied on first boot of DietPi only, ONCE! ##### +#------------------------------------------------------------------------------------------------------ + +##### Language/Regional options ##### +# Locale: e.g.: "en_GB.UTF-8" / "de_DE.UTF-8" | One entry and UTF-8 ONLY! +AUTO_SETUP_LOCALE={{ dietpi.auto_setup.locale|default('C.UTF-8') }} + +# Keyboard layout e.g.: "gb" / "us" / "de" / "fr" +AUTO_SETUP_KEYBOARD_LAYOUT={{ dietpi.auto_setup.keyboard_layout|default('us') }} + +# Time zone e.g.: "Europe/London" / "America/New_York" | Full list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones +AUTO_SETUP_TIMEZONE={{ dietpi.auto_setup.timezone|default('UTC') }} + +##### Network options ##### +# Enable Ethernet or WiFi adapter: 1=enable | 0=disable +# - If both Ethernet and WiFi are enabled, WiFi will take priority and Ethernet will be disabled. +# - If using WiFi, please edit dietpi-wifi.txt to pre-enter credentials. +AUTO_SETUP_NET_ETHERNET_ENABLED={{ dietpi.auto_setup.net_ethernet_enabled|default(true) | ternary(1, 0) }} +AUTO_SETUP_NET_WIFI_ENABLED={{ dietpi.auto_setup.net_wifi_enabled|default(false) | ternary(1, 0) }} + +# Force Ethernet speeds: 0=automatic speed | 10 = 10 Mbit/s | 100 = 100 Mbit/s etc. +# - Use this when your Ethernet adapter has an unstable 1 Gbit/s link. +AUTO_SETUP_NET_ETH_FORCE_SPEED={{ dietpi.auto_setup.net_eth_force_speed|default(0) }} + +# WiFi country code: 2 uppercase character value (e.g. GB US DE JP): https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 +{#- Force to use WiFi country code, when WiFi is enabled. -#} +AUTO_SETUP_NET_WIFI_COUNTRY_CODE={% if dietpi.auto_setup.net_wifi_enabled|default(false) | bool %}{{ dietpi.auto_setup.net_wifi_country_code }}{% else %}{{ dietpi.auto_setup.net_wifi_country_code|default('') }}{% endif %} + +# Enter your static network details below, if applicable. +AUTO_SETUP_NET_USESTATIC={{ dietpi.auto_setup.use_static_ip|default(false) | ternary(1, 0) }} +AUTO_SETUP_NET_STATIC_IP={{ dietpi.auto_setup.net_static_ip|default('192.168.0.100') }} +AUTO_SETUP_NET_STATIC_MASK={{ dietpi.auto_setup.net_static_mask|default('255.255.255.0') }} +AUTO_SETUP_NET_STATIC_GATEWAY={{ dietpi.auto_setup.net_static_gateway|default('192.168.0.1') }} +AUTO_SETUP_NET_STATIC_DNS={{ dietpi.auto_setup.net_static_dns|default('9.9.9.9 149.112.112.112') }} + +# Set to "1" to convert DHCP leased network settings into static settings automatically on first boot. +AUTO_SETUP_DHCP_TO_STATIC={{ dietpi.auto_setup.dhcp_to_static|default(false) | ternary(1, 0) }} + +# Hostname +AUTO_SETUP_NET_HOSTNAME={{ dietpi.auto_setup.net_hostname|default('DietPi') }} + +# Delay service starts at boot until network is established: 0=disabled | 1=enabled +AUTO_SETUP_BOOT_WAIT_FOR_NETWORK={{ dietpi.auto_setup.boot_wait_for_network|default(false) | ternary(1, 0) }} + +##### Misc options ##### +# Swap space size to generate: 0 => disable | 1 => auto | 2 and up => size in MiB +AUTO_SETUP_SWAPFILE_SIZE={{ dietpi.auto_setup.swapfile_size|default(1) }} +# Swap space location: "zram" => swap space on /dev/zram0 (auto-size = 50% of RAM size) | /path/to/file => swap file at location (auto-size = 2 GiB minus RAM size) +AUTO_SETUP_SWAPFILE_LOCATION={{ dietpi.auto_setup.swapfile_location|default('/var/swap') }} + +# Set to "1" to disable HDMI/video output and framebuffers on Raspberry Pi, to reduce power consumption and memory usage: Works on RPi only! +AUTO_SETUP_HEADLESS={{ dietpi.auto_setup.headless|default(false) | ternary(1, 0) }} + +# Unmask (enable) systemd-logind service (including dbus), which is masked by default on DietPi +AUTO_UNMASK_LOGIND={{ dietpi.auto_setup.unmask_logind|default(false) | ternary(1, 0) }} + +# Custom Script (pre-networking and pre-DietPi install) +# - Allows you to automatically execute a custom script before network is up on first boot. +# - Copy your script to /boot/Automation_Custom_PreScript.sh and it will be executed automatically. +# - Executed script log: /var/tmp/dietpi/logs/dietpi-automation_custom_prescript.log + +# Custom Script (post-networking and post-DietPi install) +# - Allows you to automatically execute a custom script at the end of DietPi install. +# - Option 0 = Copy your script to /boot/Automation_Custom_Script.sh and it will be executed automatically. +# - Option 1 = Host your script online, then use e.g. AUTO_SETUP_CUSTOM_SCRIPT_EXEC=https://myweb.com/myscript.sh and it will be downloaded and executed automatically. +# - Executed script log: /var/tmp/dietpi/logs/dietpi-automation_custom_script.log +AUTO_SETUP_CUSTOM_SCRIPT_EXEC={{ dietpi.auto_setup.custom_script_exec|default('0') }} + +# Restore a DietPi-Backup on first boot: 0 => disable | 1 => interactive restore (show list of found backups) | 2 => non-interactive restore (restore first found backup) +# - Simply attach the drive/disk/stick which contains the backup. All attached drives will be mounted temporarily and searched automatically. +AUTO_SETUP_BACKUP_RESTORE={{ dietpi.auto_setup.backup_restore|default(0) }} + +##### Software options ##### +# SSH server choice: 0=none/custom | -1=Dropbear | -2=OpenSSH +AUTO_SETUP_SSH_SERVER_INDEX={{ dietpi.auto_setup.ssh_server_index|default(-2) }} + +# SSH server pubkey +# - Public key(s) for "root" and "dietpi" users, which will be added to ~/.ssh/authorized_keys +# - Use the same setting multiple times for adding multiple keys. +# - See SOFTWARE_DISABLE_SSH_PASSWORD_LOGINS below for disabling SSH password logins. +AUTO_SETUP_SSH_PUBKEY={{ dietpi.auto_setup.ssh_pubkey|default('') }} + +# Logging mode choice: 0=none/custom | -1=RAMlog hourly clear | -2=RAMlog hourly save to disk + clear | -3=Rsyslog + Logrotate +AUTO_SETUP_LOGGING_INDEX={{ dietpi.auto_setup.logging_index|default(-2) }} +# RAMlog max tmpfs size (MiB). 50 MiB should be fine for single use. 200+ MiB for heavy webserver access log etc. +AUTO_SETUP_RAMLOG_MAXSIZE={{ dietpi.auto_setup.ramlog_maxsize|default(50) }} + +# Dependency preferences +# - DietPi-Software installs all dependencies for selected software options automatically, which can include a webserver for web applications, a desktop for GUI applications and one usually wants a web browser on desktops. +# - Especially for non-interactive first run installs (see AUTO_SETUP_AUTOMATED below), you may want to define which webserver, desktop and/or browser you want to have installed in such case. For interactive installs you will be always asked to pick one. +# - With below settings you can define your preference for non-interactive installs. However, it will only installed if any other selected software requires it, and an explicit webserver/desktop/browser selection overrides those settings: +# - Webserver preference: 0=Apache | -1=Nginx | -2=Lighttpd +AUTO_SETUP_WEB_SERVER_INDEX={{ dietpi.auto_setup.web_server_index|default(0) }} +# - Desktop preference: 0=LXDE | -1=Xfce | -2=MATE | -3=LXQt | -4=GNUstep +AUTO_SETUP_DESKTOP_INDEX={{ dietpi.auto_setup.desktop_index|default(0) }} +# - Browser preference: 0=None | -1=Firefox | -2=Chromium +AUTO_SETUP_BROWSER_INDEX={{ dietpi.auto_setup.browser_index|default(0) }} + +# DietPi-Autostart: 0=Console | 7=Console autologin | 1=Kodi | 2=Desktop autologin | 16=Desktop | 4=OpenTyrian | 5=DietPi-CloudShell | 6=Amiberry fast boot | 8=Amiberry standard boot | 9=DDX-Rebirth | 10=CAVA Spectrum | 11=Chromium kiosk | 14=Custom script (background) | 17=Custom script (foreground) +# - This will be effective on 2nd boot, after first run update and installs have been done. +# - Related software titles must be installed either on first run installs or via AUTO_SETUP_AUTOMATED=1 + AUTO_SETUP_INSTALL_SOFTWARE_ID (see below). +AUTO_SETUP_AUTOSTART_TARGET_INDEX={{ dietpi.auto_setup.autostart_target_index|default(0) }} +# Autologin user name +# - This user must exist before first run installs, otherwise it will be reverted to root. +# - Applies to all autostart options but: 0, 6, 14 and 16 +AUTO_SETUP_AUTOSTART_LOGIN_USER={{ dietpi.auto_setup.autostart_login_user|default('root') }} + +##### Non-interactive first run setup ##### +# On first login, run update, initial setup and software installs without any user input +# - Setting this to "1" is required for AUTO_SETUP_GLOBAL_PASSWORD and AUTO_SETUP_INSTALL_SOFTWARE_ID. +# - Setting this to "1" indicates that you accept the DietPi GPLv2 license, available at /boot/dietpi-LICENSE.txt, superseding AUTO_SETUP_ACCEPT_LICENSE. +AUTO_SETUP_AUTOMATED={{ dietpi.auto_setup.automated|default(1) }} + +# Global password to be applied for the system +# - Requires AUTO_SETUP_AUTOMATED=1 +# - Affects "root" and "dietpi" users login passwords and is used by dietpi-software as default for software installs which require a password. +# - During first run setup, the password is removed from this file and instead encrypted and saved to root filesystem. +# - WARN: The default SSH server Dropbear does not support passwords over 100 characters. +# - WARN: We cannot guarantee that all software options can handle special characters like \"$. +AUTO_SETUP_GLOBAL_PASSWORD={{ dietpi.auto_setup.global_password|default(ansible_password|default('dietpi')) }} + +# Software to automatically install +# - Requires AUTO_SETUP_AUTOMATED=1 +# - List of available software IDs: https://github.com/MichaIng/DietPi/wiki/DietPi-Software-list +# - Add as many entries as you wish, one each line. +# - DietPi will automatically install all dependencies, like ALSA/X11 for desktops etc. +{% for software_id in dietpi.auto_setup.install_software_id|default([]) %} +AUTO_SETUP_INSTALL_SOFTWARE_ID={{ software_id }} +{% endfor %} + +#------------------------------------------------------------------------------------------------------ +##### Misc DietPi program settings ##### +#------------------------------------------------------------------------------------------------------ +# DietPi-Survey: 1=opt in | 0=opt out | -1=ask on first call +# - https://dietpi.com/docs/dietpi_tools/#miscellaneous (see tab 'DietPi Survey') +SURVEY_OPTED_IN={{ dietpi.survey_opted_in|default(1) }} + +#------------------------------------------------------------------------------------------------------ +##### DietPi-Config settings ##### +#------------------------------------------------------------------------------------------------------ +# CPU Governor: schedutil | ondemand | interactive | conservative | powersave | performance +CONFIG_CPU_GOVERNOR={{ diet.config.cpu_governor|default('schedutil') }} +# Ondemand Sampling Rate | Min value: 10000 microseconds (10 ms) +CONFIG_CPU_ONDEMAND_SAMPLE_RATE={{ diet.config.cpu_ondemand_sample_rate|default(25000) }} +# Ondemand Sampling Down Factor: Sampling Rate * Down Factor / 1000 = ms (40 = 1000 ms when sampling rate is 25000) +CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR={{ diet.config.cpu_ondemand_sample_downfactor|default(40) }} +# Throttle Up Percentage: Percentage of average CPU usage during sampling rate at which CPU will be throttled up/down +CONFIG_CPU_USAGE_THROTTLE_UP={{ diet.config.cpu_usage_throttle_up|default(80) }} + +# CPU Frequency Limits: Disabled=disabled +# - Intel CPUs use a percentage value (%) from 0-100, e.g.: 55 +# - All other devices must use a specific MHz value, e.g.: 1600 +# - Has no effect on RPi, please set "arm_freq" and "arm_freq_min" in config.txt instead. +CONFIG_CPU_MAX_FREQ={{ diet.config.cpu_max_freq|default('Disabled') }} +CONFIG_CPU_MIN_FREQ={{ diet.config.cpu_min_freq|default('Disabled') }} + +# Disable Intel-based turbo/boost stepping. This flag should not be required, setting <100% MAX frequency should disable Turbo on Intel CPUs. +CONFIG_CPU_DISABLE_TURBO={{ diet.config.cpu_disable_turbo|default(false)| ternary(1, 0) }} + +# System-wide proxy settings +# - Do not modify, you must use dietpi-config > "Network Options: Adapters" to apply +CONFIG_PROXY_ADDRESS={{ diet.config.proxy_address|default('') }} +CONFIG_PROXY_PORT={{ diet.config.proxy_port|default('') }} +CONFIG_PROXY_USERNAME={{ diet.config.proxy_username|default('') }} +CONFIG_PROXY_PASSWORD={{ diet.config.proxy_password|default('') }} + +# Connection timeout in seconds for G_CHECK_NET and G_CHECK_URL. Increase if you have a "flaky" connection or slow DNS resolver. +# - Set this to "0" to allow unlimited time, however this is not recommended to avoid unlimited hanging background scripts, e.g. daily DietPi update check. +# - A negative or non-integer value will result in the default of 10 seconds. +CONFIG_G_CHECK_URL_TIMEOUT={{ diet.config.g_check_url_timeout|default(10) }} +# Connection attempts with above timeout each, before G_CHECK_NET and G_CHECK_URL give up and prompt an error. +# - Any value below "1" or a non-integer value will result in the default of 2 attempts. +CONFIG_G_CHECK_URL_ATTEMPTS={{ diet.config.g_check_url_attempts|default(2) }} +# General connection and DNS testing +# - IPv4 address to ping when checking network connectivity. Default: 9.9.9.9 (Quad9 DNS IP) +CONFIG_CHECK_CONNECTION_IP={{ diet.config.check_connection_ip|default('9.9.9.9') }} +# - IPv6 address to ping when checking network connectivity. Default: 2620:fe::fe (Quad9 DNS IP) +CONFIG_CHECK_CONNECTION_IPV6={{ diet.config.check_connection_ipv6|default('2620:fe::fe') }} +# - Domain to resolve when checking DNS resolver. Default: dns9.quad9.net (Quad9 DNS domain) +CONFIG_CHECK_DNS_DOMAIN={{ diet.config.check_dns_domain|default('dns9.quad9.net') }} + +# Daily check for DietPi updates: 0=disable | 1=enable +# - Checks are done by downloading a file of only 7 bytes. +CONFIG_CHECK_DIETPI_UPDATES={{ diet.config.check_dietpi_updates|default(true) | ternary(1, 0) }} + +# Daily check for APT package updates: 0=disable | 1=check only | 2=check and upgrade automatically +# - Upgrade logs can be found at: /var/tmp/dietpi/logs/dietpi-update_apt.log +CONFIG_CHECK_APT_UPDATES={{ diet.config.check_apt_updates|default(1) }} + +# Network time sync: 0=disabled | 1=boot only | 2=boot + daily | 3=boot + hourly | 4=Daemon + Drift +CONFIG_NTP_MODE={{ diet.config.ntp_mode|default(2) }} + +# Serial Console: Set to 0 if you do not require serial console. +CONFIG_SERIAL_CONSOLE_ENABLE={{ diet.config.serial_console_enable|default(1) }} + +# Sound card +CONFIG_SOUNDCARD={{ diet.config.soundcard|default('none') }} + +# LCD Panel addon +# - Do not modify, you must use dietpi-config to configure/set options +CONFIG_LCDPANEL={{ diet.config.lcdpanel|default('none') }} + +# IPv6 +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 +# - Raspbian: https://www.raspbian.org/RaspbianMirrors +CONFIG_APT_RASPBIAN_MIRROR={{ diet.config.apt_raspbian_mirror|default('http://raspbian.raspberrypi.org/raspbian/') }} +# - Debian: https://www.debian.org/mirror/official#list +CONFIG_APT_DEBIAN_MIRROR={{ diet.config.apt_debian_mirror|default('http://deb.debian.org/debian/') }} + +# NTP mirror, applied to /etc/ntp.conf +# - For a full list, please see: https://www.ntppool.org/zone/@ +# - Please remove the initial integer and full stop from the value (removing "0."), eg: debian.pool.ntp.org +CONFIG_NTP_MIRROR={{ diet.config.ntp_mirror|default('debian.pool.ntp.org') }} + +#------------------------------------------------------------------------------------------------------ +##### DietPi-Software settings ##### +#------------------------------------------------------------------------------------------------------ +# SSH Server +# - Disable SSH password logins, e.g. when using pubkey authentication +# 0=Allow password logins for all users, including root +# root=Disable password login for root user only +# 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) }} + +# VNC Server +SOFTWARE_VNCSERVER_WIDTH={{ diet.software.vncserver_width|default(1280) }} +SOFTWARE_VNCSERVER_HEIGHT={{ diet.software.vncserver_height|default(720) }} +SOFTWARE_VNCSERVER_DEPTH={{ diet.software.vncserver_depth|default(16) }} +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) }} + +# ownCloud/Nextcloud +# - Optional username for admin account, the default is 'admin', applied during install +SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME={{ diet.software.owncloud_nextcloud_username|default('admin') }} +# - Optional data directory, default is "/mnt/dietpi_userdata/owncloud_data" respectively "/mnt/dietpi_userdata/nextcloud_data", applied during install +SOFTWARE_OWNCLOUD_DATADIR={{ diet.software.owncloud_datadir|default('/mnt/dietpi_userdata/owncloud_data') }} +SOFTWARE_NEXTCLOUD_DATADIR={{ diet.software.nextcloud_datadir|default('/mnt/dietpi_userdata/nextcloud_data') }} + +# WiFi Hotspot +SOFTWARE_WIFI_HOTSPOT_SSID={{ diet.software.wifi_hotspot_ssid|default('DietPi-HotSpot') }} +# - Key requires a minimum of 8 characters +SOFTWARE_WIFI_HOTSPOT_KEY={{ diet.software.wifi_hotspot_key|default('dietpihotspot') }} +SOFTWARE_WIFI_HOTSPOT_CHANNEL={{ diet.software.wifi_hotspot_channel|default(3) }} + +# X.org +# - DPI 96(default) 120(+25%) 144(+50%) 168(+75%) 192(+100%) +SOFTWARE_XORG_DPI={{ diet.software.xorg_dpi|default(96) }} + +# Chromium +SOFTWARE_CHROMIUM_RES_X={{ diet.software.chromium_res_x|default(1280) }} +SOFTWARE_CHROMIUM_RES_Y={{ diet.software.chromium_res_y|default(720) }} +SOFTWARE_CHROMIUM_AUTOSTART_URL={{ diet.software.chromium_autostart_url|default('https://dietpi.com') }} + +# Home Assistant +# - Optional Python build dependencies and modules, possibly required for certain HA components +# Space separated list (no quotation!), will be installed together with Home Assistant automatically, if present +SOFTWARE_HOMEASSISTANT_APT_DEPS={{ diet.software.homeassistant_apt_deps|default('') }} +# Add Python modules with version string at best, e.g.: firstModule==1.2.3 secondModule==4.5.6 +SOFTWARE_HOMEASSISTANT_PIP_DEPS={{ diet.software.homeassistant_pip_deps|default('') }} + +# K3s +# Command with flags to use for launching K3s in the service +# The value of this variable is copied directly into the INSTALL_K3S_EXEC environment variable before +# running the K3s installer. +# https://rancher.com/docs/k3s/latest/en/installation/install-options/#options-for-installation-with-script +# +# Optionally, you can add a configuration file named /boot/dietpi-k3s.yaml, +# which will be copied into place during installation. +# https://rancher.com/docs/k3s/latest/en/installation/install-options/#configuration-file +SOFTWARE_K3S_EXEC={{ diet.software.k3s_exec|default('') }} + +# DietPi-Dashboard +# Version to use +# - Stable = Use release version of DietPi-Dashboard. +# - 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') }} +# Whether to only install backend or not +SOFTWARE_DIETPI_DASHBOARD_BACKEND={{ diet.software.dietpi_dashboard_backend|default(false)| ternary(1, 0) }} + +# PiVPN +# - For an unattended install, place a config file named "unattended_pivpn.conf" into the boot partition/directory. +# - For example configs, have a look at: https://github.com/pivpn/pivpn/tree/master/examples + +# Shairport Sync +# - Uncomment and set to "2" to install experimental AirPlay 2 build: https://github.com/mikebrady/shairport-sync/blob/master/AIRPLAY2.md +#SOFTWARE_SHAIRPORT_SYNC_AIRPLAY=2 + +# UrBackup Server +# - Backup path, optional, defaults to "/mnt/dietpi_userdata/urbackup", effective on fresh UrBackup Server installs only +SOFTWARE_URBACKUP_BACKUPPATH={{ diet.software.urbackup_backuppath|default('/mnt/dietpi_userdata/urbackup') }} + +#------------------------------------------------------------------------------------------------------ +##### Dev settings ##### +#------------------------------------------------------------------------------------------------------ +DEV_GITBRANCH={{ diet.dev.gitbranch|default('master') }} +DEV_GITOWNER={{ diet.dev.gitowner|default('MichaIng') }} + +#------------------------------------------------------------------------------------------------------ +##### Settings, automatically added by dietpi-update ##### +#------------------------------------------------------------------------------------------------------ diff --git a/serguzim/sbc/roles/dietpi-install/vars/main.yml b/serguzim/sbc/roles/dietpi-install/vars/main.yml new file mode 100644 index 0000000..c51349d --- /dev/null +++ b/serguzim/sbc/roles/dietpi-install/vars/main.yml @@ -0,0 +1 @@ +dietpi_download_base: "https://dietpi.com/downloads/images" diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..f62b98a --- /dev/null +++ b/shell.nix @@ -0,0 +1,8 @@ +with import {}; +mkShell { + nativeBuildInputs = [ + ansible + ansible-lint + sshpass + ]; +}