feat(ansible): add Docker host configuration with NFS mounts and utility packages
- Introduce Docker host configuration playbooks in `docker_host` role - Install Docker and Docker Compose via apt repository - Configure Docker user, group, and required directories (`/opt/docker`, `/media`) - Add NFS mounts for Docker data, series, movies, and songs directories - Add extra utility packages (`bat`, `ripgrep`, `fd-find`, `screen`, `eza`, `neovim`) - Set up and manage `bash_aliases` for user-friendly command replacements (`batcat`, `nvim`, `eza`) - Enhance `/group_vars` and `/host_vars` for Docker-related settings and secure access - Add `docker-host00` and `docker-host01` entries to production and staging inventories Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
59
roles/docker_host/tasks/installation.yml
Normal file
59
roles/docker_host/tasks/installation.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
- name: Uninstall old versions
|
||||
ansible.builtin.apt:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
purge: true
|
||||
loop:
|
||||
- docker
|
||||
- docker-engine
|
||||
- docker.io
|
||||
- containerd
|
||||
- runc
|
||||
become: true
|
||||
|
||||
- name: Update cache
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
become: true
|
||||
|
||||
- name: Install dependencies for apt to use repositories over HTTPS
|
||||
ansible.builtin.apt:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop:
|
||||
- ca-certificates
|
||||
- curl
|
||||
- gnupg
|
||||
- lsb-release
|
||||
become: true
|
||||
|
||||
- name: Add Docker apt key.
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ docker.url }}/{{ ansible_distribution | lower }}/gpg"
|
||||
dest: /etc/apt/trusted.gpg.d/docker.asc
|
||||
mode: "0664"
|
||||
force: true
|
||||
become: true
|
||||
|
||||
- name: Add Docker repository.
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb [arch={{ arch }}] {{ docker.url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker.apt_release_channel }}"
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Update cache
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
become: true
|
||||
|
||||
- name: Install Docker Engine, containerd, and Docker Compose.
|
||||
ansible.builtin.apt:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- docker-compose-plugin
|
||||
- containerd.io
|
||||
become: true
|
||||
Reference in New Issue
Block a user