Docker Compose
Install AnsibleForms and MySQL together with docker-compose or podman-compose
- Prerequisites
- Choose a location to install
- Clone the docker-compose project
- Set proper permissions
- Install a container engine
- Customize
- Start docker-compose project
- Test the application
- File structure
The docker-compose project contains both containers, their settings and sample forms, so the only other requirement is Docker or Podman with its compose tool.
Prerequisites
Before you start, you need:
- Linux machine : any distribution, with modest CPU and memory
- GitHub access : to download or clone the docker-compose project from GitHub
- Docker or Podman : a container engine, installed below
- A compose tool : Docker Compose or podman-compose, to start AnsibleForms and MySQL from a few configuration files
VIDEO: How to install AnsibleForms
Choose a location to install
Create a folder for the project; the examples use /srv/apps:
sudo mkdir /srv/apps
cd /srv/apps
Clone the docker-compose project
Install Git:
sudo apt-get install -y git
sudo apt-get install -y git
sudo dnf install -y git
Then clone the docker-compose project into that folder:
sudo git clone https://github.com/ansibleforms/docker.git ansibleforms-docker
cd ansibleforms-docker
Set proper permissions
Give the application write access to the data folder:
# write access will be needed on the datafolder
sudo chmod -R u+rwX,g+rwX ./data
Install a container engine
Install Docker or Podman, each with its compose tool:
Install Docker Engine with the Compose plugin from Docker’s repository (see the Docker installation manuals):
# Docker's own apt repository
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
| sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Docker's own apt repository
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
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
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Docker's own dnf repository (Rocky / Alma : use .../linux/centos/docker-ce.repo)
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Then let names resolve inside the containers, and start Docker as a service:
sudo mkdir -p /etc/docker
echo "{\"dns-opts\":[\"ndots:15\"]}" | sudo tee /etc/docker/daemon.json
sudo systemctl enable --now docker
Podman does not require a service. Install it together with podman-compose:
sudo apt-get install -y podman podman-compose
sudo apt-get install -y podman podman-compose
sudo dnf install -y podman
# podman-compose comes from EPEL (on RHEL, enable EPEL as Red Hat documents it)
sudo dnf install -y epel-release
sudo dnf install -y podman-compose
Customize
Review the variables in the .env and docker-compose.yml files and adjust them as needed. Learn more about the environment variables
Start docker-compose project
Start MySQL and AnsibleForms in the background:
sudo docker compose up -d
# with the older standalone tool : sudo docker-compose up -d
sudo podman-compose up -d
# podman is service-less : you can run it as any user, with or without sudo
Test the application
Once the containers are up, open AnsibleForms in a browser:
- Open
https://your_ip(port 443, seeWEBAPP_LOCAL_PORTin the .env file) - Log in as
admin/AnsibleForms!123(or with the password you chose in the.envfile) - Next steps:
- Create forms by adding YAML files to the data/forms/ folder or by using the built-in designer
- Add your playbooks to the data/playbooks/ folder
- Add an LDAP connection
- Add users and groups
- Add an AWX connection
- Add credentials for external connections, such as other MySQL servers or REST APIs, or to pass to Ansible playbooks
- Connect Git repositories and choose whether your forms and/or playbooks sync with a repository
File structure
The docker-compose project has the following folder structure:
.
├── docker-compose.yml # the AnsibleForms and MySQL containers
├── .env # the settings, see the variables below
└── data # everything that must survive an upgrade
├── ansible # ansible.cfg, plus roles and collections you install
├── forms # 1 or more yaml files with forms
├── functions # custom javascript functions
├── git # .gitconfig for repository connections
├── mysql
│ ├── my.cnf # MySQL settings
│ └── db # the database files (created at first start)
├── playbooks # your ansible playbooks
├── repositories # local clones of your git repositories
├── ssh # the client sshkey (created at first start)
├── config.yaml # categories, roles and constants
├── certificates # self-signed certificates (created at first start) - replace with your own
├── logs # the logfiles (created at first start)
├── backups # database backups (created when needed)
└── forms_backups # form backups (created when needed)