This Ansible playbook configures the postfix service on different hosts (Proxmox nodes as well as Proxmox Backup Server).
1. Install Ansible
on a certain Linux host from which Ansible playbook are to be run, this host is called for brevity below Ansible config host
For Debian
Linux
sudo apt update
sudo apt install ansible
or follow step 2 of Setting up config machine
section to install the latest Ansible version
git clone https://github.com/Alliedium/awesome-proxmox.git $HOME/awesome-proxmox
3. Install Ansible postfix role - Oefenweb/ansible-postfix
ansible-galaxy install -r $HOME/awesome-proxmox/postfix/playbooks/config-postfix/requirements.yml
Check installed role
ansible-galaxy list
Ansible vault provides a way to encrypt and manage sensitive data such as passwords. We use Ansible vault to store pve_postfix_sasl_user
and pve_postfix_sasl_password
variables
cp $HOME/awesome-proxmox/postfix/playbooks/config-postfix/secrets-file.enc.example $HOME/awesome-proxmox/postfix/playbooks/config-postfix/secrets-file.enc
Encrypt $HOME/awesome-proxmox/postfix/playbooks/config-postfix/secrets-file.enc
file and set a password by command
ansible-vault encrypt $HOME/awesome-proxmox/postfix/playbooks/config-postfix/secrets-file.enc
$HOME/awesome-proxmox/postfix/playbooks/config-postfix/secrets-file.enc
file is encrypted
cp $HOME/awesome-proxmox/postfix/inventory $HOME/awesome-proxmox/postfix/my-inventory
- In
$HOME/awesome-proxmox/postfix/my-inventory/hosts.yml
file replace hosts IP addresses to your hosts IP addresses and edit the path to private key to match it on your machine. Our hosts in fact assume to include our Proxmox nodes as well as (possibly) Proxmox Backup Server.
Run ansible playbook
Run the script
$HOME/awesome-proxmox/postfix/playbooks/config-postfix/run.sh
You could provide your inventory
folder (path to your inventory folder) as script parameter
$HOME/awesome-proxmox/postfix/playbooks/config-postfix/run.sh [<inventory_path>]
If the path given by <inventory_path>
is not given, then ../../my-inventory/
will be used by default (according to the name of the inventory above).