https://github.com/khalil-as/ansible_docker_install
Install Docker on Debian 12 box
https://github.com/khalil-as/ansible_docker_install
ansible-role debian-linux docker installation
Last synced: 3 months ago
JSON representation
Install Docker on Debian 12 box
- Host: GitHub
- URL: https://github.com/khalil-as/ansible_docker_install
- Owner: Khalil-AS
- Created: 2025-03-04T09:20:06.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-04T16:27:29.000Z (over 1 year ago)
- Last Synced: 2025-03-12T01:34:50.140Z (over 1 year ago)
- Topics: ansible-role, debian-linux, docker, installation
- Homepage:
- Size: 73.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
🚀 **Ansible Role: Docker Installation**
📌 **Overview**
This Ansible role automates the installation and configuration of Docker on Debian-based systems. It ensures that Docker is properly set up with the latest stable version and configures the system for optimal containerized application deployment.
✅ **Features**
✔️ Removes old Docker packages (if any)
✔️ Updates system packages
✔️ Installs Docker and its dependencies
✔️ Configures Docker to start on boot
✔️ Adds the user to the docker group
✔️ Ensures Docker is running and verifies installation
📋 **Prerequisites**
🛠 Supported Operating Systems (Tested)
Debian 12+
⚙️ **Required Dependencies**
Ensure the control machine has:
ansible-core 2.15.13
Python 3.9.21
community.docker 4.4.0
Paramiko 3.5.1
Ensure the target machine has:
Internet access (for package downloads)
Python 3.11.2
🔑 **Privileges**
Run playbooks as a user with sudo privileges and SSH key-based authentication.
In this role, the default user is control.
🚀 **Quick Start Guide**
1️⃣ **Install the Role**
Clone this repository or download it:
git clone https://github.com/Kharune/ansible_docker_install.git
cd ansible-role-docker
2️⃣ **Configure Inventory, Playbook, and Ansible Configuration**
Before running the playbook, ensure the following files are properly configured based on your environment.
Inventory Configuration (hosts.yml)
lab:
vars:
ansible_python_interpreter: auto_silent
hosts:
192.168.253.130:22450 # Change this based on your environment and ssh port, if default used remove (:ssh_port)
preprod:
children:
lab:
Playbook Configuration (PB_deploy_docker.yml)
---
- name: Install Docker on Debian
hosts: preprod # Change this based on your target group
remote_user: control # Change this based on your user
become: true
roles:
- docker_install
Ansible Configuration (ansible.cfg)
Ensure your Ansible configuration is set correctly:
[defaults]
inventory=/home/control/ansible_docker_install/hosts.yml # Change to your inventory file
transport=paramiko # Change if you don't use paramiko
3️⃣ **Run the Playbook**
Run the playbook:
ansible-playbook PB_deploy_docker.yml
🐳**Demo**
https://github.com/user-attachments/assets/104e1157-1c16-4a47-b34b-15b4da9fb7af