diff --git a/manifests/northd.pp b/manifests/northd.pp index cdd9461..6d7da80 100644 --- a/manifests/northd.pp +++ b/manifests/northd.pp @@ -3,10 +3,23 @@ # # installs ovn package starts the ovn-northd service # -class ovn::northd() { +# [*dbs_listen_ip*] +# The IP-Address where OVN DBs should be listening +# Defaults to '0.0.0.0' +# +class ovn::northd($dbs_listen_ip = '0.0.0.0') { include ::ovn::params include ::vswitch::ovs + if $::osfamily == 'RedHat' { + augeas { 'sysconfig-ovn-northd': + context => '/files/etc/sysconfig/ovn-northd', + changes => "set OVN_NORTHD_OPTS '\"--db-nb-addr=${dbs_listen_ip} --db-sb-addr=${dbs_listen_ip} \ +--db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=yes\"'", + before => Service['northd'], + } + } + service { 'northd': ensure => true, enable => true, diff --git a/spec/classes/ovn_northd_spec.rb b/spec/classes/ovn_northd_spec.rb index 320377c..07d4307 100644 --- a/spec/classes/ovn_northd_spec.rb +++ b/spec/classes/ovn_northd_spec.rb @@ -2,6 +2,19 @@ require 'spec_helper' describe 'ovn::northd' do + shared_examples_for 'systemd env' do + it 'creates systemd conf' do + is_expected.to contain_file('/etc/sysconfig/ovn-northd').with( + :ensure => 'file', + :mode => '0644', + :owner => 'root', + :group => 'root', + :content => "OVN_NORTHD_OPTS=--db-nb-addr=0.0.0.0 --db-sb-addr=0.0.0.0 --db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=yes", + :before => 'Service[northd]', + ) + end + end + shared_examples_for 'ovn northd' do it 'includes params' do is_expected.to contain_class('ovn::params') @@ -56,6 +69,7 @@ describe 'ovn::northd' do } end it_behaves_like 'ovn northd' + it_behaves_like 'systemd env' end end end