diff --git a/.fixtures.yml b/.fixtures.yml index 98b5a1f6..29c3f21f 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -49,5 +49,7 @@ fixtures: 'vcsrepo': 'git://github.com/enovance/puppetlabs-vcsrepo' 'stdlib': 'git://github.com/enovance/puppetlabs-stdlib.git' 'xinetd': 'git://github.com/enovance/puppetlabs-xinetd.git' + 'rhnreg_ks': 'git://github.com/enovance/puppet-rhnreg_ks.git' + 'dnsclient': 'git://github.com/enovance/puppet-module-dnsclient.git' symlinks: 'cloud': '#{source_dir}' diff --git a/examples/params.pp b/examples/params.pp index c8bbf0e8..92d68b6f 100644 --- a/examples/params.pp +++ b/examples/params.pp @@ -322,6 +322,14 @@ class os_params { $api_eth = $internal_netif_ip $storage_eth = $storage_netif_ip + # Red Hat Network registration + $rhn_registration = { + username => 'rhn', + password => 'pass', + server_url => 'https://rhn.redhat.com/rpc/api', + force => true, + } + # OpenStack Identity $identity_roles_addons = ['SwiftOperator', 'ResellerAdmin'] $keystone_db_allowed_hosts = $db_allowed_hosts diff --git a/manifests/init.pp b/manifests/init.pp index 3d45c866..71832351 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -18,7 +18,9 @@ # Installs the private cloud system requirements # -class cloud { +class cloud( + $rhn_registration = $os_params::rhn_registration, +) { if ! ($::osfamily in [ 'RedHat', 'Debian' ]) { fail("module puppet-cloud only support ${::osfamily}, only Red Hat or Debian") @@ -70,4 +72,9 @@ This node is under the control of Puppet ${::puppetversion}. enable => true } + if $::osfamily == 'RedHat' and $rhn_registration { + create_resources('rhn_register', { + "${::hostname}" => $rhn_registration + } ) + } } diff --git a/spec/classes/cloud_init_spec.rb b/spec/classes/cloud_init_spec.rb index 83ab4b18..652da0c1 100644 --- a/spec/classes/cloud_init_spec.rb +++ b/spec/classes/cloud_init_spec.rb @@ -77,10 +77,17 @@ describe 'cloud' do let :facts do { :osfamily => 'RedHat', :concat_basedir => '/var/lib/puppet/concat', - :puppetversion => '3.3' } + :puppetversion => '3.3', + :hostname => 'redhat1' } + end + + let :params do + { :rhn_registration => { "username" => "rhn", "password" => "pass" } } end # it_configures 'private cloud node' + + it { should contain_rhn_register('redhat1') } end context 'on other platforms' do