text
stringlengths
0
152
sudo echo "localhost ansible_connection=local" >> /etc/ansible/hosts &&
mkdir -p ~/ansible/playbooks
We’ve installed Ansible simply because it’s a quick and easy way to get all the depen‐
dencies met. We’ve written a playbook to perform the following operations:
1. Install dnf, vim, wget, and MySQL-python.
2. Install the MySQL community-edition repository.
3. Install mysql-server.
4. Tweak some variables in the mysql-server installation.
5. Start the mysql-server daemon.
6. Modify some MySQL credentials (create users, set passwords).
7. Create a MySQL database/schema for Asterisk to use.
8. Apply some security best practices (remove anonymous user, test database, etc.).
9. Create asterisk user.
10. Create astmin user.
11. Install dependencies for ODBC.
12. Install some diagnostic tools.
13. Tweak the firewall to allow SIP and RTP traffic.
14. Edit some ODBC config files.
This can all be done manually, but it’s just a lot of typing, and Ansible is really good at
streamlining this process.
Create an Ansible playbook in the file ~/ansible/playbooks/starfish.yml.
30
|
Chapter 3: Installing Asterisk
The libmyodbc8a.so file is versioned, so, if you don’t have version 8
of UnixODBC:
1. Run the playbook the first time (to install the UnixODBC
library).
2. Find
out what
file was
installed
at
/usr/lib64/
libmyodbc<version>a.so.
3. Edit the playbook as appropriate (provide the correct file‐
name).
4. Save and rerun the playbook (which will then update the con‐
figuration files to point to the correct library).
Here’s the playbook:
---
- hosts: starfish
become: yes
vars:
# Use these on the first run of this playbook
current_mysql_root_password: ""
updated_mysql_root_password: "YouNeedAReallyGoodPassword"
current_mysql_asterisk_password: ""
updated_mysql_asterisk_password: "YouNeedAReallyGoodPasswordHereToo"
# Comment the above out after the first run
# Uncomment these for subsequent runs
# current_mysql_root_password: "YouNeedAReallyGoodPassword"
# updated_mysql_root_password: "{{ current_mysql_root_password }}"
# current_mysql_asterisk_password: "YouNeedAReallyGoodPasswordHereToo"
# updated_mysql_asterisk_password: "{{ current_mysql_asterisk_password }}"
tasks:
- name: Install epel-release
dnf:
name: epel-release
state: present
- name: Install dependencies
dnf:
name: ['vim', 'wget', 'MySQL-python']
state: present