This guide deploys Eggdrop using Docker containers managed by Ansible. It combines container isolation with automated deployment.
- name: Deploy Eggdrop with Docker
hosts: eggdrop
become: true
vars:
eggdrop_name: eggdrop
eggdrop_image: eggdrop:latest
eggdrop_config_dir: /opt/eggdrop
eggdrop_container_name: eggdrop
tasks:
- name: Install prerequisites on Debian family
ansible.builtin.apt:
update_cache: true
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
state: present
when: ansible_os_family == "Debian"
- name: Install prerequisites on RHEL family
ansible.builtin.dnf:
name:
- dnf-utils
state: present
when: ansible_os_family == "RedHat"
- name: Add Docker GPG key (Debian/Ubuntu)
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
when: ansible_os_family == "Debian"
- name: Add Docker repository (Debian/Ubuntu)
ansible.builtin.apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
state: present
filename: docker
when: ansible_os_family == "Debian"
- name: Add Docker repository (RHEL)
ansible.builtin.yum_repository:
name: docker-ce-stable
description: Docker CE Stable
baseurl: https://download.docker.com/linux/centos/$releasever/$basearch/stable
enabled: true
gpgcheck: true
gpgkey: https://download.docker.com/linux/centos/gpg
when: ansible_os_family == "RedHat"
- name: Install Docker Engine
ansible.builtin.apt:
update_cache: true
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
state: present
when: ansible_os_family == "Debian"
- name: Install Docker Engine (RHEL)
ansible.builtin.dnf:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Ensure Docker service is running
ansible.builtin.systemd:
name: docker
enabled: true
state: started
- name: Ensure Eggdrop config directory exists
ansible.builtin.file:
path: "{{ eggdrop_config_dir }}"
state: directory
mode: "0755"
- name: Create default Eggdrop config if missing
ansible.builtin.copy:
dest: "{{ eggdrop_config_dir }}/eggdrop.conf"
content: |
# Eggdrop Configuration
# Edit these values for your IRC network
set nick "Eggdrop"
set altnick "Eggdrop_"
set server "irc.libera.chat +6697"
set listen 3333
set userfile "UserDB"
set notify-users 0
set notify-newusers 0
set owner "admin"
set admin "admin"
set admin-email "admin@example.com"
# Add channels here
# channel add #yourchannel
force: false
mode: "0644"
- name: Pull Eggdrop Docker image
community.docker.docker_image:
name: "{{ eggdrop_image }}"
source: pull
- name: Run Eggdrop container
community.docker.docker_container:
name: "{{ eggdrop_container_name }}"
image: "{{ eggdrop_image }}"
state: started
restart_policy: unless-stopped
volumes:
- "{{ eggdrop_config_dir }}:/home/eggdrop"
command: /home/eggdrop/eggdrop.conf
networks:
- name: bridge
- name: Verify container is running
community.docker.docker_container_info:
name: "{{ eggdrop_container_name }}"
register: eggdrop_container_info
- name: Show container status
ansible.builtin.debug:
var: eggdrop_container_info.container.State.Status
For environments without Docker Compose plugin, use this alternative:
- name: Deploy Eggdrop with Docker (Native)
hosts: eggdrop
become: true
vars:
eggdrop_image: eggdrop:latest
eggdrop_config_dir: /opt/eggdrop
eggdrop_container_name: eggdrop
tasks:
- name: Install Docker on Debian family
ansible.builtin.apt:
update_cache: true
name:
- docker.io
- docker-compose
state: present
when: ansible_os_family == "Debian"
- name: Ensure Docker service is running
ansible.builtin.systemd:
name: docker
enabled: true
state: started
- name: Ensure Eggdrop config directory exists
ansible.builtin.file:
path: "{{ eggdrop_config_dir }}"
state: directory
mode: "0755"
- name: Pull Eggdrop Docker image
community.docker.docker_image:
name: "{{ eggdrop_image }}"
source: pull
- name: Run Eggdrop container
community.docker.docker_container:
name: "{{ eggdrop_container_name }}"
image: "{{ eggdrop_image }}"
state: started
restart_policy: unless-stopped
volumes:
- "{{ eggdrop_config_dir }}:/home/eggdrop"
command: /home/eggdrop/eggdrop.conf
ansible-playbook -i inventory.ini eggdrop-docker-install.yml
# Check container status
docker ps | grep eggdrop
# View container logs
docker logs eggdrop
# Test IRC connection (if bot joined a channel)
docker exec eggdrop eggdrop -v
eggdrop image stores configs in /home/eggdrop/opt/eggdrop/eggdrop.conf on the host to configure IRC server, nick, and channels