-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add success alerts, improve logs, and restructure Docker
Enhanced user feedback by adding success alerts across multiple modules. Improved logging levels for better debuggability. Restructured Docker-related files for better initialization and configuration, including new entrypoint scripts and environment variable management.
- Loading branch information
SquirrelDevelopper
committed
Nov 5, 2024
1 parent
b26e609
commit 11a876d
Showing
18 changed files
with
235 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
# Create symlinks | ||
ln -sf /data/playbooks /playbooks | ||
ln -sf /data /ansible-config | ||
|
||
# Execute the CMD | ||
exec "$@" |
249 changes: 128 additions & 121 deletions
249
server/src/ansible/00000000-0000-0000-0000-000000000001/installers/install-docker.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,128 @@ | ||
- name: Update apt package cache | ||
ansible.builtin.apt: | ||
update_cache: yes | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Install required packages for Docker (Debian-based) | ||
ansible.builtin.apt: | ||
name: | ||
- apt-transport-https | ||
- ca-certificates | ||
- curl | ||
- gnupg-agent | ||
- software-properties-common | ||
state: present | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Add Docker's official GPG key (Debian-based) | ||
ansible.builtin.shell: | | ||
sudo install -m 0755 -d /etc/apt/keyrings | ||
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc | ||
sudo chmod a+r /etc/apt/keyrings/docker.asc | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Set up the Docker repository (Debian-based) | ||
ansible.builtin.shell: | | ||
echo \ | ||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ | ||
$(. /etc/os-release && echo \"$VERSION_CODENAME\") stable" |\ | ||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Update apt package cache after adding Docker repo | ||
ansible.builtin.apt: | ||
update_cache: yes | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Install required packages for Docker (RHEL-based) | ||
ansible.builtin.yum: | ||
name: | ||
- yum-utils | ||
- device-mapper-persistent-data | ||
- lvm2 | ||
state: present | ||
when: ansible_os_family == "RedHat" | ||
|
||
- name: Add Docker's official repository (RHEL-based) | ||
ansible.builtin.command: | | ||
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | ||
when: ansible_os_family == "RedHat" | ||
|
||
- name: Ensure old versions of Docker are not installed (Debian-based) | ||
ansible.builtin.apt: | ||
name: "{{ item }}" | ||
state: absent | ||
loop: | ||
- docker | ||
- docker-engine | ||
- docker.io | ||
- containerd | ||
- runc | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Ensure old versions of Docker are not installed (RHEL-based) | ||
ansible.builtin.yum: | ||
name: "{{ item }}" | ||
state: absent | ||
loop: | ||
- docker | ||
- docker-common | ||
- docker-selinux | ||
- docker-engine | ||
when: ansible_os_family == "RedHat" | ||
|
||
- name: Install Docker CE (Debian-based) | ||
ansible.builtin.apt: | ||
name: | ||
- docker-ce | ||
- docker-ce-cli | ||
- containerd.io | ||
- docker-buildx-plugin | ||
- docker-compose-plugin | ||
state: present | ||
update_cache: yes | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Install Docker CE (RHEL-based) | ||
ansible.builtin.yum: | ||
name: | ||
- docker-ce | ||
- docker-ce-cli | ||
- containerd.io | ||
- docker-buildx-plugin | ||
- docker-compose-plugin | ||
state: present | ||
when: ansible_os_family == "RedHat" | ||
|
||
- name: Start and enable Docker service | ||
ansible.builtin.service: | ||
name: docker | ||
state: started | ||
enabled: yes | ||
|
||
- name: Add user to Docker group | ||
ansible.builtin.user: | ||
name: "{{ ansible_user_id }}" | ||
groups: docker | ||
append: yes | ||
|
||
- name: Check if user is part of docker group | ||
command: groups {{ ansible_user_id }} | ||
register: user_groups | ||
changed_when: false | ||
|
||
- name: Display message if user is not yet in the Docker group | ||
debug: | ||
msg: "User '{{ ansible_user_id }}' needs to log out and log back in to apply the group change" | ||
when: "'docker' not in user_groups.stdout" | ||
|
||
- name: Activate the changes to groups | ||
command: newgrp docker | ||
when: "'docker' not in user_groups.stdout" | ||
--- | ||
- name: Install Docker | ||
hosts: all | ||
become: true | ||
gather_facts: false | ||
|
||
tasks: | ||
- name: Update apt package cache | ||
ansible.builtin.apt: | ||
update_cache: yes | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Install required packages for Docker (Debian-based) | ||
ansible.builtin.apt: | ||
name: | ||
- apt-transport-https | ||
- ca-certificates | ||
- curl | ||
- gnupg-agent | ||
- software-properties-common | ||
state: present | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Add Docker's official GPG key (Debian-based) | ||
ansible.builtin.shell: | | ||
sudo install -m 0755 -d /etc/apt/keyrings | ||
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc | ||
sudo chmod a+r /etc/apt/keyrings/docker.asc | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Set up the Docker repository (Debian-based) | ||
ansible.builtin.shell: | | ||
echo \ | ||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ | ||
$(. /etc/os-release && echo \"$VERSION_CODENAME\") stable" |\ | ||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Update apt package cache after adding Docker repo | ||
ansible.builtin.apt: | ||
update_cache: yes | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Install required packages for Docker (RHEL-based) | ||
ansible.builtin.yum: | ||
name: | ||
- yum-utils | ||
- device-mapper-persistent-data | ||
- lvm2 | ||
state: present | ||
when: ansible_os_family == "RedHat" | ||
|
||
- name: Add Docker's official repository (RHEL-based) | ||
ansible.builtin.command: | | ||
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | ||
when: ansible_os_family == "RedHat" | ||
|
||
- name: Ensure old versions of Docker are not installed (Debian-based) | ||
ansible.builtin.apt: | ||
name: "{{ item }}" | ||
state: absent | ||
loop: | ||
- docker | ||
- docker-engine | ||
- docker.io | ||
- containerd | ||
- runc | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Ensure old versions of Docker are not installed (RHEL-based) | ||
ansible.builtin.yum: | ||
name: "{{ item }}" | ||
state: absent | ||
loop: | ||
- docker | ||
- docker-common | ||
- docker-selinux | ||
- docker-engine | ||
when: ansible_os_family == "RedHat" | ||
|
||
- name: Install Docker CE (Debian-based) | ||
ansible.builtin.apt: | ||
name: | ||
- docker-ce | ||
- docker-ce-cli | ||
- containerd.io | ||
- docker-buildx-plugin | ||
- docker-compose-plugin | ||
state: present | ||
update_cache: yes | ||
when: ansible_os_family == "Debian" | ||
|
||
- name: Install Docker CE (RHEL-based) | ||
ansible.builtin.yum: | ||
name: | ||
- docker-ce | ||
- docker-ce-cli | ||
- containerd.io | ||
- docker-buildx-plugin | ||
- docker-compose-plugin | ||
state: present | ||
when: ansible_os_family == "RedHat" | ||
|
||
- name: Start and enable Docker service | ||
ansible.builtin.service: | ||
name: docker | ||
state: started | ||
enabled: yes | ||
|
||
- name: Add user to Docker group | ||
ansible.builtin.user: | ||
name: "{{ ansible_user_id }}" | ||
groups: docker | ||
append: yes | ||
|
||
- name: Check if user is part of docker group | ||
command: groups {{ ansible_user_id }} | ||
register: user_groups | ||
changed_when: false | ||
|
||
- name: Display message if user is not yet in the Docker group | ||
debug: | ||
msg: "User '{{ ansible_user_id }}' needs to log out and log back in to apply the group change" | ||
when: "'docker' not in user_groups.stdout" | ||
|
||
- name: Activate the changes to groups | ||
command: newgrp docker | ||
when: "'docker' not in user_groups.stdout" |
Oops, something went wrong.