ANSIBLE Example
TODO: This is rehashed ODL example, refactor portions into something appropriate for this talk
Ansible
IPR underway to import into ODL-managed repos
Ansible
Good OS support
(CentOS, Fedora, Ubuntu 16.04)
Ansible
Daily tests in ODL CI
Ansible
Example: Vagrant provisioner
Ansible
At a high level...
Ansible
# Box that installs ODL via its Ansible role on CentOS 7
config.vm.define "cent7_ansible" do |cent7_ansible|
# Build Vagrant box based on CentOS 7
cent7_ansible.vm.box = "centos/7"
# Install ODL using the Ansible provisioner
cent7_ansible.vm.provision "ansible" do |ansible|
# Path to Ansible playbook that installs ODL using ODL's Ansible role
ansible.playbook = "provisioning/playbook.yml"
end
end
Ansible
ansible.playbook = "provisioning/playbook.yml"
ansible
Provision the box
Ansible
[~/vagrant-opendaylight]$ vagrant up cent7_ansible
ansible
At a high level...
Ansible
TASK: [opendaylight | Add ODL yum repo] **********************************
changed: [cent7_ansible]
TASK: [opendaylight | Install ODL via RPM repo] **************************
changed: [cent7_ansible]
Ansible
TASK: [opendaylight | Check if FirewallD service is running] *************
ok: [cent7_ansible]
TASK: [opendaylight | Open ODL NB REST port via FirewallD] ***************
skipping: [cent7_ansible]
Ansible
TASK: [opendaylight | Start ODL systemd service] *************************
changed: [cent7_ansible]
Ansible
[~/vagrant-opendaylight]$ vagrant ssh cent7_ansible
[vagrant@localhost ~]$
Ansible
[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active
Ansible
Example: Config change
Ansible
[~/vagrant-opendaylight]$ cat provisioning/playbook.yml
---
- hosts: all
sudo: yes
roles:
- role: opendaylight
extra_features: ['odl-netvirt-openstack']
Ansible
[~/vagrant-opendaylight]$ vagrant provision cent7_ansible
ansible
At a high level...
Ansible
TASK: [opendaylight | Configure ODL Karaf features] **********************
changed: [cent7_ansible]
Ansible
NOTIFIED: [opendaylight | Stop ODL] **************************************
changed: [cent7_ansible]
NOTIFIED: [opendaylight | Cleanup Karaf] *********************************
changed: [cent7_ansible]
NOTIFIED: [opendaylight | Start ODL] *************************************
changed: [cent7_ansible]
Ansible
[~/vagrant-opendaylight]$ vagrant ssh cent7_ansible
Ansible
[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active
Ansible
[vagrant@localhost ~]$ ssh -p 8101 karaf@localhost
# password "karaf"
Ansible
opendaylight-user@root>feature:list | grep odl-netvirt-openstack
odl-netvirt-openstack | 0.3.0-Boron | x | <snip>