blob: 3040bd7baff15b9bb9dbf7a1a9e7f6f11dcceadd [file] [log] [blame]
Tadas Sutkaitis4ace4182023-02-27 04:31:52 +02001# Copyright (c) 2023 VEXXHOST, Inc.
Mohammed Naser336caf42022-03-11 17:56:45 -05002#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
Tadas Sutkaitis4ace4182023-02-27 04:31:52 +020015- name: Remove containerd package
16 ansible.builtin.package:
17 name: "{{ containerd_package_name }}"
18 state: absent
Mohammed Naser336caf42022-03-11 17:56:45 -050019
Tadas Sutkaitis4ace4182023-02-27 04:31:52 +020020- name: Install containerd binaries
21 ansible.builtin.copy:
22 src: "{{ containerd_download_unarchive_dest }}/{{ item }}"
23 dest: "{{ containerd_bin_dir }}/{{ item }}"
24 mode: "0755"
25 remote_src: true
26 loop: "{{ containerd_binaries }}"
27 notify: Restart containerd
Mohammed Naser336caf42022-03-11 17:56:45 -050028
Tadas Sutkaitis4ace4182023-02-27 04:31:52 +020029- name: Remove containerd orphaned binaries
Mohammed Naser336caf42022-03-11 17:56:45 -050030 ansible.builtin.file:
Tadas Sutkaitis4ace4182023-02-27 04:31:52 +020031 path: "/usr/bin/{{ item }}"
32 state: absent
33 loop: "{{ containerd_binaries }}"
34 when: containerd_bin_dir != "/usr/bin"
35
36- name: Create systemd service file for containerd
37 ansible.builtin.template:
38 src: containerd.service.j2
39 dest: /etc/systemd/system/containerd.service
40 mode: "0644"
41 notify:
42 - Reload systemd
43 - Restart containerd
44
45- name: Create folders for configuration
46 ansible.builtin.file:
47 dest: "{{ item }}"
Mohammed Naser336caf42022-03-11 17:56:45 -050048 state: directory
Tadas Sutkaitis4ace4182023-02-27 04:31:52 +020049 mode: "0755"
Mohammed Naser511c3fa2022-03-17 17:54:10 -040050 owner: root
51 group: root
Tadas Sutkaitis4ace4182023-02-27 04:31:52 +020052 with_items:
53 - "{{ containerd_cfg_dir }}"
54 - "{{ containerd_storage_dir }}"
55 - "{{ containerd_state_dir }}"
Mohammed Naser336caf42022-03-11 17:56:45 -050056 notify:
57 - Restart containerd
58
Tadas Sutkaitis4ace4182023-02-27 04:31:52 +020059- name: Create containerd config file
Mohammed Naser336caf42022-03-11 17:56:45 -050060 ansible.builtin.template:
61 src: config.toml.j2
62 dest: /etc/containerd/config.toml
Mohammed Naser511c3fa2022-03-17 17:54:10 -040063 owner: root
64 group: root
Tadas Sutkaitis4ace4182023-02-27 04:31:52 +020065 mode: "0644"
Mohammed Naser336caf42022-03-11 17:56:45 -050066 notify:
67 - Restart containerd
68
69- name: Force any restarts if necessary
Mohammed Naser511c3fa2022-03-17 17:54:10 -040070 ansible.builtin.meta: flush_handlers
Mohammed Naser336caf42022-03-11 17:56:45 -050071
72- name: Enable and start service
73 ansible.builtin.service:
74 name: containerd
75 enabled: true
76 state: started