diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..6279e45 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,9 @@ +--- + +exclude_paths: + - .ansible/ + - .cache/ + - .github/ + +skip_list: + - no-handler diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..6b1f6de --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +--- + +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly diff --git a/.github/deploy.yml b/.github/deploy.yml new file mode 100644 index 0000000..4731ce0 --- /dev/null +++ b/.github/deploy.yml @@ -0,0 +1,4 @@ +- hosts: all + become: true + roles: + - role: docker_install diff --git a/.github/workflows/ansible_lint.yml b/.github/workflows/ansible_lint.yml index 8aea454..822a228 100644 --- a/.github/workflows/ansible_lint.yml +++ b/.github/workflows/ansible_lint.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: install dependencies run: > diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/README.md b/README.md index 5535646..9a251e8 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,24 @@ Ansible: Install Docker Role ============================ -This Ansible role installs the Docker CE repository and Docker itself. +This Ansible role installs the Docker CE repository and Docker itself on EL8/9/10. It will start and enable the service so that the host is ready to run containers. +Supported Linux Distributions +-----------------------------use + +This role supports: + +- RHEL +- CentOS Stream +- Rocky Linux +- AlmaLinux OS + +Version support: + +- 10 (experimental) +- 9 +- 8 (deprecated) Example Playbook ---------------- @@ -14,5 +29,14 @@ Example of how to use the role: - hosts: all become: true roles: - - role: elan.docker_install + - role: docker_install +``` + +Example `requirements.yml`: +```yaml +--- +roles: + - src: https://github.com/virtUOS/docker_install.git + scm: git + version: 0.1.0 ``` diff --git a/meta/main.yml b/meta/main.yml index f21d053..434b58f 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -3,17 +3,12 @@ galaxy_info: author: Lars Kiesow role_name: docker_install - namespace: elan - company: ELAN e.V. + namespace: virtuos + company: Osnabrück University description: Installs Docker CE on Red Hat based systems license: BSD-3-Clause min_ansible_version: 2.9.0 galaxy_tags: - docker - system - platforms: - - name: EL - versions: - - '8' - - '9' dependencies: [] diff --git a/tasks/el10.yml b/tasks/el10.yml new file mode 100644 index 0000000..703e4ae --- /dev/null +++ b/tasks/el10.yml @@ -0,0 +1,26 @@ +--- + +- name: Install kernel modules + ansible.builtin.package: + name: kernel-modules-extra + register: _extra_kernel_modules + +- name: Reboot after installing kernel modules + ansible.builtin.reboot: + msg: Rebooting after module install + reboot_timeout: 300 + post_reboot_delay: 30 + when: _extra_kernel_modules.changed + +- name: Re-gather facts after reboot + ansible.builtin.setup: + when: _extra_kernel_modules.changed + +- name: Load kernel modules for iptables compaatibility on el10 + community.general.modprobe: + name: '{{ item }}' + persistent: present + loop: + - xt_addrtype + - nf_nat + - nf_conntrack diff --git a/tasks/main.yml b/tasks/main.yml index bd37892..8d40083 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,9 @@ --- +- name: Load kernel modules on el10 + ansible.builtin.include_tasks: el10.yml + when: ansible_distribution_major_version == "10" + - name: Install docker repository ansible.builtin.get_url: url: https://download.docker.com/linux/centos/docker-ce.repo @@ -16,7 +20,6 @@ - containerd.io - docker-buildx-plugin - docker-compose-plugin - state: present - name: Enable docker ansible.builtin.service: