57 lines
2 KiB
YAML
57 lines
2 KiB
YAML
---
|
|
# Tasks for the moby_engine role on Fedora 32
|
|
|
|
# Infrastructure
|
|
# Ansible instructions to deploy the infrastructure
|
|
# Copyright (C) 2020 Saibotk
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, version 3 of the License.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
- name: Install moby-engine.
|
|
ansible.builtin.package:
|
|
name: 'moby-engine'
|
|
state: 'present'
|
|
become: true
|
|
notify: Restart docker service
|
|
|
|
- name: Ensure Docker is started and enabled at boot.
|
|
ansible.builtin.service:
|
|
name: docker
|
|
state: "{{ moby_engine_docker_service_state }}"
|
|
enabled: "{{ moby_engine_docker_service_enabled }}"
|
|
become: true
|
|
|
|
- name: Check if line is present
|
|
ansible.builtin.shell: cat /etc/default/grub | grep GRUB_CMDLINE_LINUX_DEFAULT
|
|
changed_when: false
|
|
ignore_errors: true
|
|
register: moby_engine_grub_default
|
|
|
|
- name: Ensure that GRUB_CMDLINE_LINUX_DEFAULT is present
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/default/grub
|
|
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT'
|
|
line: 'GRUB_CMDLINE_LINUX_DEFAULT=""'
|
|
become: true
|
|
notify: Regenerate grub config
|
|
when: moby_engine_grub_default.rc != 0
|
|
|
|
# This method will only add the parameter if it was not already added
|
|
# NOTICE: If the parameter was manually added, it will not be altered!
|
|
- name: Enable legacy cgroup v1 support (to allow CPU/RAM limits etc)
|
|
ansible.builtin.replace:
|
|
path: /etc/default/grub
|
|
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT=\"((?:(?!systemd\.unified_cgroup_hierarchy=).)*?)"$'
|
|
replace: 'GRUB_CMDLINE_LINUX_DEFAULT="\1 systemd.unified_cgroup_hierarchy=0"'
|
|
become: true
|
|
notify: Regenerate grub config
|