inoxio.ispconfig3
Ansible Role: Install and Customize ISPConfig 3 on Ubuntu Bionic
The inoxio.ispconfig3 role helps you set up ISPConfig on your Ubuntu 18.04 system. This guide follows the tutorial from howtoforge.com and explains how to customize the installation. It also includes instructions on using Molecule for testing your setup.
Requirements
- Ubuntu 18.04 machine
Dependencies
- oefenweb.apt
Role Variables
You’ll need to set some variables related to Mail, PHPMyAdmin, and Roundcube for admin passwords. Also, Mail requires an email to send messages.
ISPConfig is the main part of this role, with many configuration options. Most settings correspond to the autoinstall.php file from ISPConfig. Remember, the mysql_root_password
is necessary for setting up the MariaDB module.
Essential Playbook Variables
These variables must be defined in the playbook (passwords will be auto-generated if omitted):
Mail Settings:
mail_admin_email
: Email for Mailman updates.mail_admin_password
: (Optional) Password for Mailman admin. Auto-generated if left blank.mail_base_domain
: Base domain for Mailman.
phpMyAdmin and Roundcube Settings:
phpmyadmin_hostname
: Base domain for phpMyAdmin.roundcube_admin_password
: (Optional) Password for Roundcube admin. Auto-generated if left blank.
ISPConfig Settings:
- Various settings related to ISPConfig setup. Check the ISPConfig example for all variables.
Default Variables:
- These settings provide defaults you can override:
language
: System language.ispconfig_install_mode
: Default isstandard
.- MySQL settings:
ispconfig_mysql_hostname
,ispconfig_mysql_root_user
, etc.
Quota
The quota_mounts
list contains directories for quota management. An empty list means quota won't be enabled. If your server kernel doesn't support quotas, leave it empty.
Multiple PHP Versions
You can define multiple PHP versions to install in the vars/main.yml
.
Example Playbook
Here’s how your playbook might look:
- role: inoxio.ispconfig3
mail_admin_email: [email protected]
mail_base_domain: your-company.com
ispconfig_hostname: ispconfig.your-company.com
roundcube_hostname: mail.your-company.de
Refer to this link for ISPConfig settings.
Running Tests with Molecule
To test your Ansible roles using Molecule, follow these steps:
- Install Virtualenv: Run
sudo apt install virtualenv
. - Create Virtualenv: Inside your project folder, run
virtualenv --no-site-packages .venv
. - Activate Virtualenv: Use
source .venv/bin/activate
whenever you start a new console session. - Install Molecule: Run
pip3 install molecule ansible
. Also, install the necessary driver withpip install python-vagrant
.
To run tests, just go to your virtual environment and execute:
molecule test
This will set up your testing environment and run various tests.
Creating a New Role
To create a new role with Vagrant:
molecule init role -r new-role -d vagrant
Upgrading Molecule
To keep Molecule up to date, run:
pip install --upgrade molecule
Example Molecule Configuration
Here's a basic structure for Molecule.yml
:
---
dependency:
name: galaxy
driver:
name: vagrant
provider:
name: virtualbox
lint:
name: yamllint
platforms:
- name: instance
box: ubuntu/bionic64
memory: 4096
provisioner:
name: ansible
scenario:
name: default
test_sequence:
- destroy
- syntax
- create
- prepare
- converge
- idempotence
- verify
- destroy
verifier:
name: testinfra
Conclusion on Molecule
Using Vagrant instead of Docker for testing worked better for this role, as it handled services and configurations more smoothly. Follow the tips to effectively integrate Molecule into your role development process.
Installs and customizes ISPConfig 3 on Ubuntu Bionic
ansible-galaxy install inoxio.ispconfig3