- 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>
96 lines
2.4 KiB
YAML
96 lines
2.4 KiB
YAML
---
|
|
- name: Ensure /etc/apt/keyrings directory exists
|
|
ansible.builtin.file:
|
|
path: /etc/apt/keyrings
|
|
state: directory
|
|
mode: "0755"
|
|
become: true
|
|
|
|
- name: Download and save Gierens repository GPG key
|
|
ansible.builtin.get_url:
|
|
url: https://raw.githubusercontent.com/eza-community/eza/main/deb.asc
|
|
dest: /etc/apt/keyrings/gierens.asc
|
|
mode: "0644"
|
|
register: gpg_key_result
|
|
become: true
|
|
|
|
- name: Add Gierens repository to apt sources
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb [signed-by=/etc/apt/keyrings/gierens.asc] http://deb.gierens.de stable main"
|
|
state: present
|
|
update_cache: true
|
|
become: true
|
|
|
|
- name: Install eza package
|
|
ansible.builtin.apt:
|
|
name: eza
|
|
state: present
|
|
become: true
|
|
|
|
- name: Install bottom package
|
|
ansible.builtin.apt:
|
|
deb: https://github.com/ClementTsang/bottom/releases/download/0.9.6/bottom_0.9.6_amd64.deb
|
|
state: present
|
|
become: true
|
|
|
|
- name: Check if Neovim is already installed
|
|
ansible.builtin.command: "which nvim"
|
|
register: neovim_installed
|
|
changed_when: false
|
|
ignore_errors: true
|
|
|
|
- name: Download Neovim AppImage
|
|
ansible.builtin.get_url:
|
|
url: https://github.com/neovim/neovim/releases/download/v0.10.0/nvim.appimage
|
|
dest: /tmp/nvim.appimage
|
|
mode: "0755"
|
|
when: neovim_installed.rc != 0
|
|
register: download_result
|
|
|
|
- name: Extract Neovim AppImage
|
|
ansible.builtin.command:
|
|
cmd: "./nvim.appimage --appimage-extract"
|
|
chdir: /tmp
|
|
when: download_result.changed
|
|
register: extract_result
|
|
|
|
- name: Copy extracted Neovim files to /usr
|
|
ansible.builtin.copy:
|
|
src: /tmp/squashfs-root/usr/
|
|
dest: /usr/
|
|
remote_src: true
|
|
mode: "0755"
|
|
become: true
|
|
when: extract_result.changed
|
|
|
|
- name: Clean up extracted Neovim files
|
|
ansible.builtin.file:
|
|
path: /tmp/squashfs-root
|
|
state: absent
|
|
when: extract_result.changed
|
|
|
|
- name: Remove Neovim AppImage
|
|
ansible.builtin.file:
|
|
path: /tmp/nvim.appimage
|
|
state: absent
|
|
when: download_result.changed
|
|
|
|
- name: Check if Neovim config directory already exists
|
|
ansible.builtin.stat:
|
|
path: ~/.config/nvim
|
|
register: nvim_config
|
|
|
|
- name: Clone LazyVim starter to Neovim config directory
|
|
ansible.builtin.git:
|
|
repo: https://github.com/LazyVim/starter
|
|
dest: ~/.config/nvim
|
|
clone: true
|
|
update: false
|
|
when: not nvim_config.stat.exists
|
|
|
|
- name: Remove .git directory from Neovim config
|
|
ansible.builtin.file:
|
|
path: ~/.config/nvim/.git
|
|
state: absent
|
|
when: not nvim_config.stat.exists
|