Skip to content

Khalil-AS/ansible_guacamole_docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

21 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Ansible Role: Apache Guacamole Docker Deployment with HAProxy & SSL

๐Ÿ“Œ Overview

This Ansible role automates the deployment of Apache Guacamole with HAProxy as a reverse proxy and a self-signed SSL certificate for secure remote access.

โœ… Features

โœ”๏ธ Deploys Guacamole using Docker & Docker Compose

โœ”๏ธ Sets up MariaDB as the database backend

โœ”๏ธ Configures HAProxy for load balancing and SSL termination

โœ”๏ธ Generates a self-signed SSL certificate for HTTPS access

โœ”๏ธ Initializes the Guacamole database schema

โœ”๏ธ Ensures all services are running and configured properly

๐Ÿ“‹ Prerequisites

๐Ÿ›  Supported Operating Systems (Tested)

Debian 12+

โš™๏ธ Required Dependencies

Ensure the control machine has :

Ansible-core 2.15.13

Python 3.9.21

Paramiko 3.5.1

Ansible collection community.docker

Ansible collection community.crypto

Ensure the target machine has :

Internet access (for package downloads)

Docker and Docker Compose installed

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_guacamole_docker.git
cd ansible_guacamole_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
preprod:
  children:
    lab:

Playbook Configuration (PB_deploy_guacamole.yml)

---
- name: Deploy Guacamole with HAProxy & SSL
  hosts: preprod  # Change this based on your target group
  remote_user: control  # Change this based on your user
  become: true
  roles:
    - guacamole_docker_with_https

Ansible Configuration (ansible.cfg)

Ensure your Ansible configuration is set correctly :

[defaults]
inventory=/home/control/ansible_guacamole_docker/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_guac_services.yml

โš™๏ธ Role Variables

Customize the role variables by modifying defaults/main.yml :

# Database Configuration
mysql_root_password: "your_password"
mysql_database: "guacamole"
mysql_user: "guacamole"
mysql_password: "your_password"

# SSL Configuration
fqdn: "guacamole.example.com"
ssl_cert_path: "/etc/ssl/certs/guacamole.pem"
ssl_key_path: "/etc/ssl/private/guacamole.key"

๐Ÿ”’ SSL & HAProxy Configuration

This role automatically generates a self-signed SSL certificate for HAProxy :

Certificate Path: /etc/ssl/certs/guacamole.pem

Key Path: /etc/ssl/private/guacamole.key

To use a Let's Encrypt certificate instead :

Replace the generated certificate with a valid Let's Encrypt cert.

Update the HAProxy configuration to point to the new certificate paths.

File : HAProxy Configuration (haproxy.cfg.j2)

This role configures HAProxy to :

Terminate SSL at the proxy

Forward traffic to Guacamole

Redirect HTTP to HTTPS

๐Ÿฅ‘ Demo

demo.mp4

๐Ÿฅ‘ Apache Guacamole default credential : guacadmin/guacadmin

About

Ansible role to deploy Apache Guacamole with self-signed certificate

Topics

Resources

Stars

Watchers

Forks

Languages