Allow the networking_ansible plugin to set manage_vlans

This is required if neworks already exist and the driver
doesn't need too (or can't) create them.

Change-Id: Iff08440feb5727d436514ceaf072faed7fcdf763
This commit is contained in:
Derek Higgins 2018-10-17 12:58:52 +01:00 committed by Dan Radez
parent 42b30bf20d
commit 0ea6a7a5d1
4 changed files with 16 additions and 2 deletions

View File

@ -16,7 +16,8 @@
# <host2> => {"ansible_network_os" => "junos", # <host2> => {"ansible_network_os" => "junos",
# "ansible_host" => "10.0.0.2", # "ansible_host" => "10.0.0.2",
# "ansible_user" => 'ansible', # "ansible_user" => 'ansible',
# "ansible_ssh_private_key_file" => "/private/key"}, # "ansible_ssh_private_key_file" => "/private/key",
# "manage_vlans" => false},
# } # }
# #
# [*package_ensure*] # [*package_ensure*]

View File

@ -24,6 +24,9 @@
# [*hostname*] # [*hostname*]
# (required) The hostname of a host connected to the switch. # (required) The hostname of a host connected to the switch.
# #
# [*manage_vlans*]
# Should networking-ansible create and delete VLANs on the device.
#
define neutron::plugins::ml2::networking_ansible_host( define neutron::plugins::ml2::networking_ansible_host(
$ansible_network_os, $ansible_network_os,
$ansible_host, $ansible_host,
@ -31,6 +34,7 @@ define neutron::plugins::ml2::networking_ansible_host(
$ansible_ssh_pass = undef, $ansible_ssh_pass = undef,
$ansible_ssh_private_key_file = undef, $ansible_ssh_private_key_file = undef,
$hostname = $title, $hostname = $title,
$manage_vlans = undef,
) { ) {
include ::neutron::deps include ::neutron::deps
require ::neutron::plugins::ml2 require ::neutron::plugins::ml2
@ -47,5 +51,6 @@ define neutron::plugins::ml2::networking_ansible_host(
"${section}/ansible_user": value => $ansible_user; "${section}/ansible_user": value => $ansible_user;
"${section}/ansible_ssh_pass": value => $ansible_ssh_pass, secret => true; "${section}/ansible_ssh_pass": value => $ansible_ssh_pass, secret => true;
"${section}/ansible_ssh_private_key_file": value => $ansible_ssh_private_key_file; "${section}/ansible_ssh_private_key_file": value => $ansible_ssh_private_key_file;
"${section}/manage_vlans": value => $manage_vlans;
} }
} }

View File

@ -0,0 +1,4 @@
---
features:
- |
Added support for networking-ansible's manage_vlans parameter

View File

@ -21,7 +21,8 @@ describe 'neutron::plugins::ml2::networking_ansible' do
'host2' => { 'ansible_network_os' => 'junos', 'host2' => { 'ansible_network_os' => 'junos',
'ansible_host' => '10.0.0.1', 'ansible_host' => '10.0.0.1',
'ansible_user' => 'ansible', 'ansible_user' => 'ansible',
'ansible_ssh_private_key_file' => '/path/to/key'},} 'ansible_ssh_private_key_file' => '/path/to/key',
'manage_vlans' => false},}
} }
end end
@ -50,6 +51,9 @@ describe 'neutron::plugins::ml2::networking_ansible' do
is_expected.to contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_private_key_file').with_value('/path/to/key') is_expected.to contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_private_key_file').with_value('/path/to/key')
is_expected.to contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_pass').with_value(nil) is_expected.to contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_pass').with_value(nil)
is_expected.to contain_neutron_plugin_ml2('ansible:host1/manage_vlans').with_value(nil)
is_expected.to contain_neutron_plugin_ml2('ansible:host2/manage_vlans').with_value(false)
end end
} }
end end