Organize and tag roles

This commit is contained in:
Correl Roush 2024-12-03 18:14:01 -05:00
parent 12236c6c8d
commit 909cc137ad
5 changed files with 62 additions and 48 deletions

View file

@ -2,5 +2,7 @@
hosts: asterisk hosts: asterisk
become: true become: true
roles: roles:
- asterisk - role: asterisk
- phone-provisioning tags: asterisk
- role: phone-provisioning
tags: provisioning

View file

@ -0,0 +1,25 @@
- name: Configure extensions
template:
src: extensions.conf.j2
dest: /etc/asterisk/extensions.conf
notify: reload dialplan
- name: Configure SIP clients
template:
src: pjsip.conf.j2
dest: /etc/asterisk/pjsip.conf
notify: reload sip
- name: Configure mailboxes
template:
src: voicemail.conf.j2
dest: /etc/asterisk/voicemail.conf
notify: reload voicemail
- name: Configure HTTP interface
template:
src: http.conf.j2
dest: /etc/asterisk/http.conf
notify: reload core
- name: Configure ARI interface
template:
src: ari.conf.j2
dest: /etc/asterisk/ari.conf
notify: reload core

View file

@ -1,27 +1,8 @@
- name: Configure extensions - name: Configure Asterisk
template: tags: asterisk-configuration
src: extensions.conf.j2 ansible.builtin.include_tasks:
dest: /etc/asterisk/extensions.conf file: configure_asterisk.yml
notify: reload dialplan - name: Install Voicemail API
- name: Configure SIP clients tags: voicemail-api
template: ansible.builtin.include_tasks:
src: pjsip.conf.j2
dest: /etc/asterisk/pjsip.conf
notify: reload sip
- name: Configure mailboxes
template:
src: voicemail.conf.j2
dest: /etc/asterisk/voicemail.conf
notify: reload voicemail
- name: Configure HTTP interface
template:
src: http.conf.j2
dest: /etc/asterisk/http.conf
notify: reload core
- name: Configure ARI interface
template:
src: ari.conf.j2
dest: /etc/asterisk/ari.conf
notify: reload core
- ansible.builtin.include_tasks:
file: install_voicemail_api.yml file: install_voicemail_api.yml

View file

@ -0,0 +1,17 @@
- name: Configure TFTP provisioning server
ansible.builtin.lineinfile:
path: /etc/default/tftpd-hpa
regexp: '^TFTP_DIRECTORY='
line: TFTP_DIRECTORY="/var/lib/tftpboot"
notify: restart tftpd
- name: Configure HTTP provisioning server
ansible.builtin.template:
src: 001-tftpboot.conf.j2
dest: /etc/apache2/sites-available/001-tftpboot.conf
notify: reload apache2
- name: Enable HTTP provisioning server
ansible.builtin.file:
src: /etc/apache2/sites-available/001-tftpboot.conf
dest: /etc/apache2/sites-enabled/001-tftpboot.conf
state: link
notify: reload apache2

View file

@ -1,25 +1,14 @@
- ansible.builtin.include_tasks: - name: Install Apache2
ansible.builtin.include_tasks:
file: install_apache2.yml file: install_apache2.yml
- ansible.builtin.include_tasks: - name: Install TFTPd
ansible.builtin.include_tasks:
file: install_tftpd.yml file: install_tftpd.yml
- name: Copy phone files - name: Copy phone provisioning files
tags: phone-configuration
ansible.builtin.copy: ansible.builtin.copy:
src: tftpboot/ src: tftpboot/
dest: /var/lib/tftpboot/ dest: /var/lib/tftpboot/
- name: Configure TFTP provisioning server - name: Configure and enable phone provisioning
ansible.builtin.lineinfile: ansible.builtin.include_tasks:
path: /etc/default/tftpd-hpa file: configure_provisioning.yml
regexp: '^TFTP_DIRECTORY='
line: TFTP_DIRECTORY="/var/lib/tftpboot"
notify: restart tftpd
- name: Configure HTTP provisioning server
ansible.builtin.template:
src: 001-tftpboot.conf.j2
dest: /etc/apache2/sites-available/001-tftpboot.conf
notify: reload apache2
- name: Enable HTTP provisioning server
ansible.builtin.file:
src: /etc/apache2/sites-available/001-tftpboot.conf
dest: /etc/apache2/sites-enabled/001-tftpboot.conf
state: link
notify: reload apache2