The document discusses using deployment tools like Ansible to automate configuration management. Previously, manual deployment and patching occurred every two weeks. Ansible can enable continuous deployment, automatic testing and rollback, and remove the need for specialized knowledge. It works by triggering Jenkins when code is pushed, building packages, running Ansible scripts to install packages, configure systems, run tests, and rollback if needed. Templates allow host-specific configurations. Ansible can perform tasks across multiple systems and be used to automate common administration tasks.
2. Jöran Vinzens
linkedin.com/in/jvinzens @vinzens81
4 years ago….
● Manual deployment
● Patchday every 2 weeks at the end of each sprint
● Manual testing
● Usually we forgot something
● different codebase dev - production
9. Jöran Vinzens
linkedin.com/in/jvinzens @vinzens81
How does it work?
Ansible script
- check already installed package version
- install new package
- install config
- reload of systems
- tests
- roll back old package
12. Jöran Vinzens
linkedin.com/in/jvinzens @vinzens81
● restarting
● real time communication
● ongoing sessions
● retransmits
● UDP/TCP services
● loadbalancer
● big config files
● lots of different components
VoIP is not your average service
14. Jöran Vinzens
linkedin.com/in/jvinzens @vinzens81
what we did:
- several iterations
- lots of different systems
- lot of mistakes
the best we know so far:
- install code by debian package management
- create config by ansible (host- / group-specific)
VoIP is not your average service
43. Jöran Vinzens
linkedin.com/in/jvinzens @vinzens81
Things you can do with ansible:
create and check mysql access
- name: make sure mysql user for GW exists
mysql_user:
name: "{{ db_user }}"
password: "{{ db_pass }}"
host: "{{ ansible_default_ipv4.address }}"
priv: "{{ db_name }}.*:SELECT,EXECUTE"
state: present
config_file: "~/.cnf"
delegate_to: "{{ db_host }}"
44. Jöran Vinzens
linkedin.com/in/jvinzens @vinzens81
Things you can do with ansible:
create and check mysql access
- name: check database connection
shell: echo select 1 | mysql -h{{ db_host }} -u{{ db_user }} -p{{ db_pass
}} {{ db_name }}
register: db_checkresult
- name: fail if connection is not successful
fail:
msg: "Failed to connect to database, exiting here"
when:
- db_checkresult.stdout_lines[1] != '1'
45. Jöran Vinzens
linkedin.com/in/jvinzens @vinzens81
Things you can do with ansible:
enter host into dispatcher set
- name: Write dispatcher to database
shell: echo insert ignore into dispatcher
(setid,destination,flags,priority,attrs,description) values ({{
dispatcherset_id }},"sip:{{ service_ip }}:5060",1,0,"","") | mysql {{
dn_name }}
delegate_to: "db.sip.com"
46. Jöran Vinzens
linkedin.com/in/jvinzens @vinzens81
Things you can do with ansible:
enter host into dispatcher set
- name: reload dispatcher set in Kamailio Loadbalancer(s)
command: /usr/sbin/kamcmd -s /tmp/kamailio_ctl dispatcher.reload
delegate_to: "loadbalancer.sip.com"
47. Jöran Vinzens
linkedin.com/in/jvinzens @vinzens81
Things you can do with ansible:
enter host into dispatcher set
- name: check for dispatcher state
shell: /usr/sbin/kamcmd -s /tmp/kamailio_ctl dispatcher.list | grep -A2 {{
localip }} |grep FLAGS
delegate_to: "loadbalancer.sip.com"
register: dispatcherlist
48. Jöran Vinzens
linkedin.com/in/jvinzens @vinzens81
Things you can do with ansible:
enter host into dispatcher set
- name: Check for kamailio dispatcher.list
fail:
msg: "Gateway is not ready, yet. Check firewall and IP!"
when: "'IP' in '{{ item[0].stdout }}'"
with_items:
- [ "{{ dispatcherlist.results }}" ]