Add support for Ubuntu containers and WSL verification

- Implemented tasks for managing Ubuntu containers using Podman, including inspection, creation, starting, and SSH setup.
- Added verification tasks for WSL and Podman installation, machine existence, and NSSM service status.
- Created PowerShell scripts for Podman auto-start on Windows boot.
- Introduced Prometheus role with default configurations and installation tasks.
- Updated Windows SSH role to improve authorized_keys management and permissions handling.
- Modified inventory to include Windows containers host.
- Updated Grafana datasource configurations with direct IP addresses for Prometheus instances.
This commit is contained in:
2026-06-07 20:35:59 +02:00
parent 3775fa4b6e
commit 25d3eafa5b
34 changed files with 1475 additions and 155 deletions
@@ -0,0 +1,106 @@
---
# ── Phase 0: WSL2 prerequisite bootstrap ─────────────────────────────────
- name: Enable Microsoft-Windows-Subsystem-Linux feature
ansible.windows.win_feature:
name: Microsoft-Windows-Subsystem-Linux
state: present
include_sub_features: true
include_management_tools: true
register: __wsl_feature
become: true
become_method: ansible.builtin.runas
become_user: SYSTEM
tags:
- roles::windows_containers::wsl_bootstrap
- name: Enable Virtual Machine Platform feature
ansible.windows.win_feature:
name: VirtualMachinePlatform
state: present
include_sub_features: true
include_management_tools: true
register: __vmp_feature
become: true
become_method: ansible.builtin.runas
become_user: SYSTEM
tags:
- roles::windows_containers::wsl_bootstrap
when: ansible_facts.os_product_type == "workstation"
- name: Enable Hyper-V feature
ansible.windows.win_feature:
name: Hyper-V
state: present
include_sub_features: true
include_management_tools: true
register: __hyperv_feature
become: true
become_method: ansible.builtin.runas
become_user: SYSTEM
tags:
- roles::windows_containers::wsl_bootstrap
when: ansible_facts.os_product_type == "server"
- name: Enable Containers feature
ansible.windows.win_feature:
name: Containers
state: present
include_sub_features: true
include_management_tools: true
register: __containers_feature
become: true
become_method: ansible.builtin.runas
become_user: SYSTEM
tags:
- roles::windows_containers::wsl_bootstrap
when: ansible_facts.os_product_type == "server"
- name: Reboot if WSL features were changed
ansible.windows.win_reboot:
reboot_timeout: 600
pre_reboot_delay: 5
post_reboot_delay: 15
become: true
become_method: ansible.builtin.runas
become_user: SYSTEM
when:
- windows_containers_wsl_reboot | default(true)
- __wsl_feature.changed or __vmp_feature.changed or __hyperv_feature.changed or __containers_feature.changed
tags:
- roles::windows_containers::wsl_bootstrap
- name: Download WSL2 kernel update package
ansible.windows.win_get_url:
url: "https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi"
dest: "{{ ansible_env.TEMP | default('C:\\Windows\\Temp') }}\\wsl_update_x64.msi"
force: false
become: true
become_method: ansible.builtin.runas
become_user: SYSTEM
tags:
- roles::windows_containers::wsl_bootstrap
- name: Install WSL2 kernel update package
ansible.windows.win_shell: |
Start-Process "msiexec.exe" -ArgumentList "/i {{ ansible_env.TEMP | default('C:\\Windows\\Temp') }}\\wsl_update_x64.msi /quiet" -NoNewWindow -Wait
exit $LASTEXITCODE
become: true
become_method: ansible.builtin.runas
become_user: SYSTEM
register: __wsl_update_result
changed_when: __wsl_update_result.rc == 0
tags:
- roles::windows_containers::wsl_bootstrap
- name: Run wsl update to update WSL2 kernel
ansible.windows.win_shell: |
wsl --update
exit $LASTEXITCODE
become: true
become_method: ansible.builtin.runas
become_user: SYSTEM
register: __wsl_set_default_result
changed_when: __wsl_set_default_result.rc == 0
tags:
- roles::windows_containers::wsl_bootstrap