feat: add basic alpine support

This commit is contained in:
Simon Cornet 2025-10-24 20:06:42 +02:00
commit 5dfc4a5f21
4 changed files with 51 additions and 1 deletions

View file

@ -54,3 +54,10 @@
name: "ssh.service"
state: "restarted"
enabled: true
# ssh
- name: "restart ssh alpine"
ansible.builtin.service:
name: "sshd"
state: "restarted"
enabled: true

21
tasks/apk/packages.yaml Normal file
View file

@ -0,0 +1,21 @@
---
# install packages
- name: "install packages"
community.general.apk:
name: "{{ item }}"
state: "present"
update_cache: true
cache_clean: true
when: 'ansible_os_family == "Alpine"'
with_items:
- "bash"
- "btop"
- "curl"
- "htop"
- "python3"
- "qemu-guest-agent"
- "sudo"
- "tzdata"
- "vim"
- "wget"

View file

@ -52,6 +52,16 @@
- name: "flush handlers"
ansible.builtin.meta: "flush_handlers"
# apk
- name: "apk"
ansible.builtin.import_tasks: "apk/packages.yaml"
when: "ansible_os_family == 'Alpine'"
tags: "apt"
# flush handler
- name: "flush handlers"
ansible.builtin.meta: "flush_handlers"
- name: "apt - update"
ansible.builtin.import_tasks: "apt/update.yaml"
when: "ansible_os_family == 'Debian'"
@ -182,7 +192,6 @@
# sshd
- name: "sshd"
ansible.builtin.import_tasks: "sshd.yaml"
when: "ansible_os_family == 'Debian'"
tags: "sshd"
# flush handler

View file

@ -9,4 +9,17 @@
group: "root"
mode: "0644"
notify: "restart ssh"
when: 'ansible_os_family == "Debian"'
tags: "sshd"
# configure sshd
- name: "config - sshd"
ansible.builtin.template:
src: "templates/sshd/sshd_config.j2"
dest: "/etc/ssh/sshd_config"
owner: "root"
group: "root"
mode: "0644"
notify: "restart ssh alpine"
when: 'ansible_os_family == "Alpine"'
tags: "sshd"