LukasGibb.asterisk-config-deploy
asterisk-config-deploy
=========
This is an Ansible role that sets up Asterisk configuration, sound, and music on hold (MOH) files from a Git repository.
The role will copy configuration files from the Git repository into a working folder and then create links to these files in the Asterisk configuration directory.
WARNING: This process will remove your original Asterisk configuration files! Avoid running it on a server that is already in use.
The role will also create links for directories that contain custom sound and MOH files.
If you want to store sound files, consider using Git LFS (Large File Storage). The role will install Git LFS for you on the server.
Asterisk Config File Override System
You can place configuration files for specific servers in a subfolder within the repository. This is useful if you have a general dial plan but need to configure different settings for various regions, offices, or customers.
For example, you could have configuration files for a US PABX in asterisk/us/
and for a UK PABX in asterisk/uk/
.
You can set the path to the appropriate subfolder in a host variable (asterisk_config_deploy_ast_override_dir
). The role will use specific configuration files from this subfolder instead of the more generic files with the same name in the main folder.
Asterisk Sounds
You can add custom Asterisk sound files to a directory in the repository (default directory: sounds
). This directory will be linked to the Asterisk 'custom' sounds directory.
Asterisk Music On Hold
You can add custom 'music on hold' files to a directory in the repository (default directory: moh
). This directory will be linked to a 'custom' directory in the Asterisk MOH directory, so the original MOH files remain intact. If you'd prefer to replace the default MOH files, set asterisk_config_deploy_moh_path
to the actual MOH path.
Requirements
You need a functioning Asterisk installation and a Git repository containing your configuration files.
If your configuration repository is private (which is recommended), consider setting up SSH agent forwarding so the Git tasks can use your SSH keys without storing them on the Asterisk server. More details are available here.
For multiple users applying this role, group them and pass the group name to the role using the asterisk_config_deploy_group
variable.
Role Variables
See defaults/main.yml
for variable details.
Dependencies
No required dependencies. Choose your preferred method for installing Asterisk. You might want to check this link for additional resources.
Example Playbook
You need to provide your Git repository details (not the example/default ones):
- hosts: pabxservers
vars:
asterisk_config_deploy_repo_protocol: "ssh://"
asterisk_config_deploy_repo_url: "github.com/myusername/myprivateasteriskconfigrepo"
asterisk_config_deploy_repo_subfolder: "asterisk-config"
asterisk_config_deploy_repo_override_subfolder: "asterisk-config/pbx1"
roles:
- LukasGibb.asterisk
- LukasGibb.asterisk-config-deploy
License
MIT License
Author Information
This role was created in 2018 by Lukas Gibb from CloudJourneyman.com.
An Ansible role that deploys Asterisk config, sounds and moh files
ansible-galaxy install LukasGibb.asterisk-config-deploy