From 6c19f8422aff11b4eb9ef9c2ef4fc17f998cc41d Mon Sep 17 00:00:00 2001 From: "Mr.Geek" <106800360+RoninAngle1@users.noreply.github.com> Date: Tue, 24 Sep 2024 18:54:55 +0330 Subject: [PATCH 1/3] Create DockerInstallation.yml --- .../prepare_env/tasks/DockerInstallation.yml | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 ansible/roles/prepare_env/tasks/DockerInstallation.yml diff --git a/ansible/roles/prepare_env/tasks/DockerInstallation.yml b/ansible/roles/prepare_env/tasks/DockerInstallation.yml new file mode 100644 index 0000000..934bad1 --- /dev/null +++ b/ansible/roles/prepare_env/tasks/DockerInstallation.yml @@ -0,0 +1,93 @@ +--- +- name: Install required packages (Debian/Ubuntu) + apt: + name: "{{ item }}" + state: present + update_cache: yes + loop: + - apt-transport-https + - ca-certificates + - curl + - software-properties-common + when: ansible_os_family == "Debian" + +- name: Install required packages (RedHat/CentOS) + yum: + name: "{{ item }}" + state: present + loop: + - yum-utils + - device-mapper-persistent-data + - lvm2 + when: ansible_os_family == "RedHat" + +- name: Add Docker GPG key (Debian/Ubuntu) + apt_key: + url: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg + state: present + when: ansible_os_family == "Debian" + +- name: Add Docker repository (Debian/Ubuntu) + apt_repository: + repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable" + state: present + when: ansible_os_family == "Debian" + +- name: Install Docker (Debian/Ubuntu) + apt: + name: docker-ce + state: present + update_cache: yes + when: ansible_os_family == "Debian" + +- name: Add Docker repository (RedHat/CentOS) + yum_repository: + name: docker + description: Docker Repository + baseurl: https://download.docker.com/linux/centos/7/x86_64/stable + gpgcheck: yes + gpgkey: https://download.docker.com/linux/centos/gpg + state: present + when: ansible_os_family == "RedHat" + +- name: Install Docker (RedHat/CentOS) + yum: + name: docker-ce + state: present + when: ansible_os_family == "RedHat" + +- name: Start and enable Docker service + service: + name: docker + state: started + enabled: "{{ lookup('env', 'START_ON_BOOT') | default('yes') == 'yes' }}" + +- name: Add user to Docker group + user: + name: "{{ lookup('env', 'DOCKER_USER') | default('ansible_user') }}" + groups: docker + append: yes + when: docker_user != '' + +- name: Install Docker Compose v2 + shell: | + curl -L "https://github.com/docker/compose/releases/download/{{ lookup('env', 'DOCKER_COMPOSE_VERSION') | default('2.19.0') }}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + chmod +x /usr/local/bin/docker-compose + args: + creates: /usr/local/bin/docker-compose + +- name: Verify Docker installation + command: docker --version + register: docker_version_output + +- name: Verify Docker Compose installation + command: docker-compose --version + register: docker_compose_version_output + +- name: Print Docker version + debug: + msg: "Docker version installed: {{ docker_version_output.stdout }}" + +- name: Print Docker Compose version + debug: + msg: "Docker Compose version installed: {{ docker_compose_version_output.stdout }}" From 551ca0e858f58af38f7cf2b7bde726b0a00c7d1b Mon Sep 17 00:00:00 2001 From: "Mr.Geek" <106800360+RoninAngle1@users.noreply.github.com> Date: Tue, 24 Sep 2024 19:39:57 +0330 Subject: [PATCH 2/3] Update index.html Adding DockerInstallation Variables --- artifacts/wiki/index.html | 54 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/artifacts/wiki/index.html b/artifacts/wiki/index.html index 2061055..f5f23cc 100644 --- a/artifacts/wiki/index.html +++ b/artifacts/wiki/index.html @@ -128,6 +128,58 @@

Boundary

Configurations

Environment Variables

Environment variables need to be configured for both Vault and Boundary. Here's an example:

+ +

The following environment variables can be used to customize the behavior of the DockerInstallation playbook:

+ + + + +
+

Return/Exit Codes

+

The return/exit codes of the various tasks within DockerInstallation playbook are as follows:

+ +
+

STACK_ENV (mandatory)

This variable determines in which mode/environment the stack is deployed.