Commit 9e12922a authored by Fabien Combernous's avatar Fabien Combernous

Merge branch '4-fix-install-replica' into 'master'

Resolve "Fix install Replica"

Closes #4

See merge request adullact/puppet-freeipa!11
parents b7e14bff f88c5846
......@@ -5,8 +5,7 @@
# @example
# include freeipa::install::server::replica
class freeipa::install::server::replica {
$replica_install_cmd = "\
/usr/sbin/ipa-replica-install \
$replica_install_cmd = "/usr/sbin/ipa-replica-install \
--principal=${freeipa::final_domain_join_principal} \
--admin-password='${freeipa::final_domain_join_password}' \
${freeipa::install::server::server_install_cmd_opts_hostname} \
......
......@@ -37,5 +37,37 @@ describe 'freeipa class' do
end
end
end
### Test Install Replica
context 'replica' do
context 'with default parameters' do
hosts_as('replica').each do |replica|
it 'applies idempotently' do
pp = <<-EOS
class {'freeipa':
ipa_role => 'replica',
domain => 'vagrant.example.lan',
ipa_server_fqdn => 'ipa-server-2.vagrant.example.lan',
domain_join_password => 'vagrant123',
install_ipa_server => true,
ip_address => '192.168.44.36',
enable_ip_address => true,
enable_hostname => true,
manage_host_entry => true,
install_epel => true,
ipa_master_fqdn => 'ipa-server-1.vagrant.example.lan',
}
EOS
apply_manifest_on(replica, pp, :catch_failures => true, :debug => true)
apply_manifest_on(replica, pp, :catch_changes => true, :debug => true)
end
describe command('ipactl status') do
its(:exit_status) { is_expected.to be 0 }
end
end
end
end
end
end
......@@ -7,6 +7,7 @@ HOSTS:
platform: el-7-x86_64
hypervisor: vagrant
box: geerlingguy/centos7
vagrant_memsize: 2048
ip: 192.168.44.35
forwarded_ports:
httpd1:
......@@ -15,6 +16,15 @@ HOSTS:
httpd2:
from: 8440
to: 8440
ipa-server-2:
roles:
- replica
platform: el-7-x86_64
hypervisor: vagrant
box: geerlingguy/centos7
vagrant_memsize: 2048
ip: 192.168.44.36
CONFIG:
type: foss
loglevel: debug
......@@ -7,7 +7,6 @@ describe 'freeipa::install::server' do
'class{"freeipa": ipa_role => "master", ipa_master_fqdn => "foo.example.com", domain_join_password => "foobartest", admin_password => "foobartest", directory_services_password => "foobartest", install_ipa_client => false, install_ipa_server => true}'
end
let(:facts) { os_facts }
let(:facts) { os_facts }
it { is_expected.to compile }
end
......
......@@ -17,6 +17,7 @@ RSpec.configure do |c|
on host, puppet('module', 'install', 'puppetlabs-stdlib')
on host, puppet('module', 'install', 'crayfishx-firewalld')
on host, puppet('module', 'install', 'puppet-selinux')
on host, puppet('module', 'install', 'saz-resolv_conf')
pp = <<-EOS
exec { 'stop network manager':
......@@ -27,8 +28,10 @@ RSpec.configure do |c|
EOS
apply_manifest_on(host, pp, catch_failures: true)
end
## Preconfigure master
## Preconfigure master
hosts_as('master').each do |master|
pp = <<-EOS
exec { 'set master /etc/hosts':
path => '/bin/',
......@@ -36,7 +39,37 @@ RSpec.configure do |c|
}
EOS
apply_manifest(pp, catch_failures: true, debug: true)
apply_manifest_on(master, pp, catch_failures: true, debug: true)
end
## Preconfigure replica
hosts_as('replica').each do |replica|
pp = <<-EOS
exec { 'set replica /etc/hosts':
path => '/bin/',
command => 'echo -e "127.0.0.1 ipa-server-2.vagrant.example.lan ipa-server-2\n ::1 ip6-localhost ip6-loopback\n fe00::0 ip6-localnet\n ff00::0 ip6-mcastprefix\n ff02::1 ip6-allnodes\n ff02::2 ip6-allrouters\n\n 192.168.44.36 ipa-server-2.vagrant.example.lan ipa-server-2\n" > /etc/hosts',
}
EOS
apply_manifest_on(replica, pp, :catch_failures => true, :debug => true)
pp = <<-EOS
class { 'resolv_conf':
nameservers => ['192.168.44.35'],
}
EOS
apply_manifest_on(replica, pp, :catch_failures => true, :debug => true)
puppet('module', 'install', 'saz-resolv_conf')
pp = <<-EOS
host {'ipa-server-1.vagrant.example.lan':
ensure => present,
ip => '192.168.44.35',
}
EOS
apply_manifest_on(replica, pp, :catch_failures => true, :debug => true)
end
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment