Mohammed Naser | 336caf4 | 2022-03-11 17:56:45 -0500 | [diff] [blame] | 1 | # Copyright (c) 2022 VEXXHOST, Inc. |
| 2 | # |
| 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 | |
| 15 | - name: Add repository |
| 16 | ansible.builtin.apt_repository: |
| 17 | repo: "deb {{ containerd_repository_url }} {{ ansible_distribution_release }} main" |
| 18 | state: present |
| 19 | when: |
| 20 | - containerd_repository_url is defined |
| 21 | |
| 22 | - name: Install packages |
| 23 | ansible.builtin.apt: |
| 24 | name: containerd |
| 25 | state: present |
| 26 | |
| 27 | - name: Create folder for configuration |
| 28 | ansible.builtin.file: |
| 29 | path: /etc/containerd |
| 30 | state: directory |
Mohammed Naser | 511c3fa | 2022-03-17 17:54:10 -0400 | [diff] [blame] | 31 | owner: root |
| 32 | group: root |
| 33 | mode: 0755 |
Mohammed Naser | 336caf4 | 2022-03-11 17:56:45 -0500 | [diff] [blame] | 34 | notify: |
| 35 | - Restart containerd |
| 36 | |
| 37 | - name: Update pause image in configuration |
| 38 | ansible.builtin.template: |
| 39 | src: config.toml.j2 |
| 40 | dest: /etc/containerd/config.toml |
Mohammed Naser | 511c3fa | 2022-03-17 17:54:10 -0400 | [diff] [blame] | 41 | owner: root |
| 42 | group: root |
| 43 | mode: 0644 |
Mohammed Naser | 336caf4 | 2022-03-11 17:56:45 -0500 | [diff] [blame] | 44 | notify: |
| 45 | - Restart containerd |
| 46 | |
Mohammed Naser | ff1980a | 2022-11-12 14:32:57 +0000 | [diff] [blame] | 47 | - name: Bump DefaultLimitMEMLOCK for system |
| 48 | ansible.builtin.lineinfile: |
| 49 | path: /etc/systemd/system.conf |
| 50 | regexp: '^DefaultLimitMEMLOCK=' |
| 51 | line: 'DefaultLimitMEMLOCK=infinity' |
| 52 | state: present |
| 53 | notify: |
| 54 | - Reload systemd |
| 55 | - Restart containerd |
| 56 | |
Mohammed Naser | 336caf4 | 2022-03-11 17:56:45 -0500 | [diff] [blame] | 57 | - name: Force any restarts if necessary |
Mohammed Naser | 511c3fa | 2022-03-17 17:54:10 -0400 | [diff] [blame] | 58 | ansible.builtin.meta: flush_handlers |
Mohammed Naser | 336caf4 | 2022-03-11 17:56:45 -0500 | [diff] [blame] | 59 | |
| 60 | - name: Enable and start service |
| 61 | ansible.builtin.service: |
| 62 | name: containerd |
| 63 | enabled: true |
| 64 | state: started |