Commit 92bc9115 authored by Fabien Combernous's avatar Fabien Combernous

Merge branch '8-install-client-ubuntu-16-04' into 'master'

Resolve "Install client Ubuntu 16.04"

Closes #8

See merge request adullact/puppet-freeipa!15
parents 3114c4f9 7b55eeea
......@@ -8,7 +8,7 @@
#
class freeipa::install {
if $freeipa::install_epel {
if ($facts['os']['family'] == 'RedHat') and ($freeipa::install_epel) {
include epel
}
......
require 'spec_helper_acceptance'
describe 'freeipa class' do
......
......@@ -4,6 +4,7 @@ HOSTS:
roles:
- default
- master
- centos
platform: el-7-x86_64
hypervisor: vagrant
box: centos/7
......@@ -14,6 +15,7 @@ HOSTS:
ipa-server-2:
roles:
- replica
- centos
platform: el-7-x86_64
hypervisor: vagrant
box: centos/7
......@@ -24,13 +26,24 @@ HOSTS:
ipa-client-centos:
roles:
- client
- centos7
- client-centos7
- centos
platform: el-7-x86_64
hypervisor: vagrant
box: centos/7
box_version: 1809.01
box_check_update: false
vagrant_memsize: 1024
ip: 192.168.44.37
ipa-client-ubuntu16:
roles:
- client
- client-ubuntu16
platform: ubuntu-1604-amd64
hypervisor: vagrant
box: geerlingguy/ubuntu1604
vagrant_memsize: 1024
ip: 192.168.44.38
CONFIG:
type: foss
......
......@@ -18,8 +18,8 @@ install_module_on(hosts)
# install_module_dependencies_on(hosts)
RSpec.configure do |c|
# Configure all nodes in nodeset
c.before :suite do
# Configure all nodes in nodeset
hosts.each do |host|
install_module_from_forge_on(host, 'saz-resolv_conf', '>= 4.0.0 < 5.0.0')
install_module_from_forge_on(host, 'puppetlabs-stdlib', '>= 4.25.0 < 5.0.0')
......@@ -31,24 +31,17 @@ RSpec.configure do |c|
onlyif => 'systemctl status NetworkManager',
path => '/usr/bin:/sbin:/bin',
}
exec { 'disable selinux':
command => 'setenforce 0',
path => '/usr/bin:/sbin:/bin',
}
EOS
apply_manifest_on(host, pp, catch_failures: true)
yumipv4 = <<-EOS
exec {'echo "ip_resolve=4" >> /etc/yum.conf':
onlyif => 'grep -v "^ip_resolve=4" /etc/yum.conf',
path => '/usr/bin:/sbin:/bin',
}
EOS
apply_manifest_on(host, yumipv4, catch_failures: true) if fact('os.family') == 'RedHat'
end
## Preconfigure master
# Configure /etc/hosts for each node.
# WARNING : function hosts_as() return an array.
# But here we use several roles dedicated, used only once time in nodeset.
# This permit to use one different IP for each role : master, replica, client-centos7 and client-ubuntu16.
# Here master with ip address 192.168.44.35
hosts_as('master').each do |master|
pp = <<-EOS
exec { 'set master /etc/hosts':
......@@ -60,7 +53,7 @@ RSpec.configure do |c|
apply_manifest_on(master, pp, catch_failures: true, debug: true)
end
## Preconfigure replica
# Here replica with ip address 192.168.44.36
hosts_as('replica').each do |replica|
pp = <<-EOS
exec { 'set replica /etc/hosts':
......@@ -79,13 +72,37 @@ RSpec.configure do |c|
apply_manifest_on(replica, pp, catch_failures: true, debug: true)
end
## Preconfigure client
hosts_as('centos7').each do |centos7|
# Here a first client running CentOS7 with ip address 192.168.44.37
hosts_as('client-centos7').each do |clientcentos7|
pp = <<-EOS
exec { 'set client centos /etc/hosts':
path => '/bin/',
command => 'echo -e "127.0.0.1 ipa-client-centos.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.37 ipa-client-centos.vagrant.example.lan ipa-client-centos\n" > /etc/hosts',
}
EOS
apply_manifest_on(clientcentos7, pp, catch_failures: true)
end
# Here a second client running Ubuntu1604 with ip address 192.168.44.38
hosts_as('client-ubuntu16').each do |clientubuntu16|
pp = <<-EOS
exec { 'set client ubuntu /etc/hosts':
path => '/bin/',
command => 'echo -e "127.0.0.1 ipa-client-ubuntu16.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.38 ipa-client-ubuntu16.vagrant.example.lan ipa-client-ubuntu16\n" > /etc/hosts',
}
EOS
apply_manifest_on(clientubuntu16, pp, catch_failures: true)
end
# WARNING : function hosts_as() return an array. We now use hosts_as() normaly with several nodes returned.
# * all clients have role 'client' in nodeset.
# * all nodes running CentOS have role 'centos' in nodeset.
# Configure all clients nodes.
hosts_as('client').each do |client|
pp = <<-EOS
class { 'resolv_conf':
nameservers => ['192.168.44.35'],
}
......@@ -93,9 +110,25 @@ RSpec.configure do |c|
ensure => present,
ip => '192.168.44.35',
}
EOS
apply_manifest_on(client, pp, catch_failures: true)
end
# Configure all centos nodes
hosts_as('centos').each do |centos|
yumipv4 = <<-EOS
exec { 'disable selinux':
command => 'setenforce 0',
path => '/usr/bin:/sbin:/bin',
}
exec {'echo "ip_resolve=4" >> /etc/yum.conf':
onlyif => 'grep -v "^ip_resolve=4" /etc/yum.conf',
path => '/usr/bin:/sbin:/bin',
}
EOS
apply_manifest_on(centos7, pp, catch_failures: true)
apply_manifest_on(centos, yumipv4, catch_failures: 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