mirror of
https://github.com/geerlingguy/ansible-role-docker.git
synced 2025-08-11 13:46:32 +02:00
Alpine support - needs a molecule test
This commit is contained in:
parent
e5adc9a528
commit
d18fd008ac
@ -27,5 +27,8 @@ docker_yum_repo_enable_edge: '0'
|
|||||||
docker_yum_repo_enable_test: '0'
|
docker_yum_repo_enable_test: '0'
|
||||||
docker_yum_gpg_key: https://download.docker.com/linux/centos/gpg
|
docker_yum_gpg_key: https://download.docker.com/linux/centos/gpg
|
||||||
|
|
||||||
|
# Used only for Alpine
|
||||||
|
configure_swapaccount: false # only works with GRUB2 automatically
|
||||||
|
|
||||||
# A list of users who will be added to the docker group.
|
# A list of users who will be added to the docker group.
|
||||||
docker_users: []
|
docker_users: []
|
||||||
|
1
files/grub-swapaccount.cfg
Normal file
1
files/grub-swapaccount.cfg
Normal file
@ -0,0 +1 @@
|
|||||||
|
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} swapaccount=1"
|
@ -5,6 +5,9 @@
|
|||||||
- include_tasks: setup-Debian.yml
|
- include_tasks: setup-Debian.yml
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
- include_tasks: setup-Alpine.yml
|
||||||
|
when: ansible_os_family == 'Alpine'
|
||||||
|
|
||||||
- name: Install Docker.
|
- name: Install Docker.
|
||||||
package:
|
package:
|
||||||
name: "{{ docker_package }}"
|
name: "{{ docker_package }}"
|
||||||
|
65
tasks/setup-Alpine.yml
Normal file
65
tasks/setup-Alpine.yml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
- name: Update cache
|
||||||
|
apk:
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
|
- name: Make sure dependencies are present
|
||||||
|
apk:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
loop:
|
||||||
|
- curl
|
||||||
|
|
||||||
|
- name: Make sure that the cgroups service is started
|
||||||
|
service:
|
||||||
|
name: cgroups
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
- name: Set fact for the Docker package name
|
||||||
|
set_fact:
|
||||||
|
docker_package: docker
|
||||||
|
|
||||||
|
- name: Check for the installed bootloader
|
||||||
|
shell:
|
||||||
|
cmd: grep "grub\|syslinux" /etc/apk/world | head -n1
|
||||||
|
changed_when: false
|
||||||
|
register: bootloader
|
||||||
|
|
||||||
|
- name: Copy the swapaccount GRUB extension file
|
||||||
|
file:
|
||||||
|
src: files/grub-swapaccount.cfg
|
||||||
|
dest: /etc/grub.d/swapaccount
|
||||||
|
when: |
|
||||||
|
configure_swapaccount and
|
||||||
|
bootloader.stdout == "grub" and
|
||||||
|
ansible_facts['cmdline'].swapaccount != 1
|
||||||
|
register: swapaccount
|
||||||
|
|
||||||
|
- name: Regenerate the GRUB config
|
||||||
|
shell:
|
||||||
|
cmd: 'grub-mkconfig -o /boot/grub/grub.cfg'
|
||||||
|
warn: false
|
||||||
|
when: |
|
||||||
|
configure_swapaccount and
|
||||||
|
bootloader.stdout == "grub" and
|
||||||
|
swapaccount.changed
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "The configured swappacount will be loaded after the next reboot"
|
||||||
|
when: swapaccount.changed and configure_swapaccount
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: |
|
||||||
|
For memory and swap limit support,
|
||||||
|
please follow https://wiki.alpinelinux.org/wiki/Docker#Extlinux
|
||||||
|
when: bootloader.stdout == "syslinux"
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: |
|
||||||
|
For memory and swap limit support,
|
||||||
|
please follow https://wiki.alpinelinux.org/wiki/Docker#Extlinux
|
||||||
|
when: bootloader.stdout == "grub" and not configure_swapaccount
|
||||||
|
|
||||||
|
- name: Reload facts
|
||||||
|
setup:
|
Loading…
Reference in New Issue
Block a user