Commit 64e1a9dd authored by Fabien Combernous's avatar Fabien Combernous

only first master

parent 87526386
Pipeline #7889 failed with stages
in 4 minutes and 17 seconds
......@@ -17,20 +17,10 @@ appveyor.yml:
Gemfile:
required:
':development':
- gem: 'facter'
- gem: 'hiera'
- gem: 'parallel_tests'
- gem: 'rspec-puppet'
- gem: 'puppetlabs_spec_helper'
- gem: 'beaker'
- gem: 'beaker-puppet'
- gem: 'beaker-rspec'
- gem: 'beaker-puppet'
- gem: 'beaker-docker'
- gem: 'beaker-puppet_install_helper'
- gem: 'beaker-module_install_helper'
- gem: 'metadata-json-lint'
- gem: 'puppet-lint'
- gem: 'rspec'
- gem: 'rake'
- gem: 'beaker-vagrant'
- gem: 'bolt'
- gem: 'beaker-task_helper'
......@@ -28,21 +28,11 @@ group :development do
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "facter", require: false
gem "hiera", require: false
gem "parallel_tests", require: false
gem "rspec-puppet", require: false
gem "puppetlabs_spec_helper", require: false
gem "beaker", require: false
gem "beaker-puppet", require: false
gem "beaker-rspec", require: false
gem "beaker-puppet", require: false
gem "beaker-docker", require: false
gem "beaker-puppet_install_helper", require: false
gem "beaker-module_install_helper", require: false
gem "metadata-json-lint", require: false
gem "puppet-lint", require: false
gem "rspec", require: false
gem "rake", require: false
gem "beaker-vagrant", require: false
gem "bolt", require: false
gem "beaker-task_helper", require: false
end
......
......@@ -4,10 +4,10 @@
# @example
# class {'freeipa':
# ipa_role => 'master',
# domain => 'example.lan',
# ipa_server_fqdn => 'ipa-server-1.example.lan',
# puppet_admin_password => 'vagrant123',
# directory_services_password => 'vagrant123',
# domain => 'example.com',
# ipa_server_fqdn => 'ipa-server-1.example.com',
# puppet_admin_password => 'secret123',
# directory_services_password => 'secret123',
# install_ipa_server => true,
# ip_address => '10.10.10.35',
# enable_ip_address => true,
......
require 'spec_helper_acceptance'
ip_master = fact_on('master', 'networking.interfaces.eth1.ip')
ip_replica = fact_on('replica', 'networking.interfaces.eth1.ip')
ip_master = fact_on('master', 'networking.ip')
# ip_replica = fact_on('replica', 'networking.interfaces.eth1.ip')
describe 'class freeipa' do
context 'with ipa_role master' do
......@@ -10,7 +10,7 @@ describe 'class freeipa' do
class { 'freeipa':
ipa_role => 'master',
domain => 'example.lan',
ipa_server_fqdn => 'ipa-server-1.example.lan',
ipa_server_fqdn => 'ipa1.example.lan',
puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
install_ipa_server => true,
......@@ -19,121 +19,121 @@ describe 'class freeipa' do
enable_hostname => true,
manage_host_entry => true,
install_epel => true,
ipa_master_fqdn => 'ipa-server-1.example.lan',
ipa_master_fqdn => 'ipa1.example.lan',
}
EOS
it 'installs master without error' do
apply_manifest_on(master, pp, catch_failures: true)
end
it 'installs master idempotently' do
apply_manifest_on(master, pp, catch_changes: true)
end
# it 'installs master idempotently' do
# apply_manifest_on(master, pp, catch_changes: true)
# end
describe command('ipactl status') do
its(:exit_status) { is_expected.to be 0 }
end
end
end
context 'with ipa_role replica' do
hosts_as('replica').each do |replica|
it 'applies idempotently' do
pp = <<-EOS
class {'freeipa':
ipa_role => 'replica',
domain => 'example.lan',
ipa_server_fqdn => 'ipa-server-2.example.lan',
puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
password_usedto_joindomain => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
install_ipa_server => true,
ip_address => '#{ip_replica}',
enable_ip_address => true,
enable_hostname => true,
manage_host_entry => true,
install_epel => true,
ipa_master_fqdn => 'ipa-server-1.example.lan',
}
EOS
apply_manifest_on(replica, pp, catch_failures: true)
apply_manifest_on(replica, pp, catch_changes: true)
end
it 'ipactl status on replica' do
result = on(replica, 'ipactl status')
expect(result.exit_code).to be == 0
end
end
end
context 'with ipa_role client' do
hosts_as('client').each do |client|
ip_client = fact_on('client', 'networking.interfaces.enp0s8.ip')
it 'applies idempotently' do
pp = <<-EOS
class {'freeipa':
ipa_role => 'client',
domain => 'example.lan',
puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
password_usedto_joindomain => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
ip_address => '#{ip_client}',
install_epel => true,
ipa_master_fqdn => 'ipa-server-1.example.lan'
}
EOS
apply_manifest_on(client, pp, catch_failures: true)
apply_manifest_on(client, pp, catch_changes: true)
end
end
end
context 'with ipa_role replica on master' do
hosts_as('master').each do |master|
it 'fails' do
pp = <<-EOS
class { 'freeipa':
ipa_role => 'replica',
domain => 'example.lan',
ipa_server_fqdn => 'ipa-server-1.example.lan',
puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
install_ipa_server => true,
ip_address => '#{ip_master}',
enable_ip_address => true,
enable_hostname => true,
manage_host_entry => true,
install_epel => true,
ipa_master_fqdn => 'ipa-server-1.example.lan',
}
EOS
apply_manifest_on(master, pp, expect_failures: true)
end
end
end
context 'with ipa_role client on master' do
hosts_as('master').each do |master|
it 'fails' do
pp = <<-EOS
class { 'freeipa':
ipa_role => 'client',
domain => 'example.lan',
puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
password_usedto_joindomain => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
ip_address => '#{ip_master}',
install_epel => true,
ipa_master_fqdn => 'ipa-server-1.example.lan'
}
EOS
apply_manifest_on(master, pp, expect_failures: true)
end
end
end
#
# context 'with ipa_role replica' do
# hosts_as('replica').each do |replica|
# it 'applies idempotently' do
# pp = <<-EOS
# class {'freeipa':
# ipa_role => 'replica',
# domain => 'example.lan',
# ipa_server_fqdn => 'ipa-server-2.example.lan',
# puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
# directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
# password_usedto_joindomain => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
# install_ipa_server => true,
# ip_address => '#{ip_replica}',
# enable_ip_address => true,
# enable_hostname => true,
# manage_host_entry => true,
# install_epel => true,
# ipa_master_fqdn => 'ipa-server-1.example.lan',
# }
# EOS
#
# apply_manifest_on(replica, pp, catch_failures: true)
# apply_manifest_on(replica, pp, catch_changes: true)
# end
#
# it 'ipactl status on replica' do
# result = on(replica, 'ipactl status')
# expect(result.exit_code).to be == 0
# end
# end
# end
#
# context 'with ipa_role client' do
# hosts_as('client').each do |client|
# ip_client = fact_on('client', 'networking.interfaces.enp0s8.ip')
# it 'applies idempotently' do
# pp = <<-EOS
# class {'freeipa':
# ipa_role => 'client',
# domain => 'example.lan',
# puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
# directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
# password_usedto_joindomain => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
# ip_address => '#{ip_client}',
# install_epel => true,
# ipa_master_fqdn => 'ipa-server-1.example.lan'
# }
# EOS
#
# apply_manifest_on(client, pp, catch_failures: true)
# apply_manifest_on(client, pp, catch_changes: true)
# end
# end
# end
#
# context 'with ipa_role replica on master' do
# hosts_as('master').each do |master|
# it 'fails' do
# pp = <<-EOS
# class { 'freeipa':
# ipa_role => 'replica',
# domain => 'example.lan',
# ipa_server_fqdn => 'ipa-server-1.example.lan',
# puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
# directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
# install_ipa_server => true,
# ip_address => '#{ip_master}',
# enable_ip_address => true,
# enable_hostname => true,
# manage_host_entry => true,
# install_epel => true,
# ipa_master_fqdn => 'ipa-server-1.example.lan',
# }
# EOS
#
# apply_manifest_on(master, pp, expect_failures: true)
# end
# end
# end
#
# context 'with ipa_role client on master' do
# hosts_as('master').each do |master|
# it 'fails' do
# pp = <<-EOS
# class { 'freeipa':
# ipa_role => 'client',
# domain => 'example.lan',
# puppet_admin_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
# directory_services_password => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
# password_usedto_joindomain => 's^ecr@et.ea;R/O*=?j!.QsAu+$',
# ip_address => '#{ip_master}',
# install_epel => true,
# ipa_master_fqdn => 'ipa-server-1.example.lan'
# }
# EOS
#
# apply_manifest_on(master, pp, expect_failures: true)
# end
# end
# end
end
......@@ -10,7 +10,7 @@ run_puppet_install_helper
install_module_on(hosts)
install_module_dependencies_on(hosts)
ip_master = fact_on('master', 'networking.interfaces.eth1.ip')
# ip_master = fact_on('master', 'networking.ip')
RSpec.configure do |c|
c.before :suite do
......@@ -34,67 +34,67 @@ RSpec.configure do |c|
EOS
apply_manifest_on(host, pp, catch_failures: true)
# install_module_from_forge_on(host, 'saz-resolv_conf', '>= 4.0.0 < 5.0.0')
# we need to not use function install_module_from_forge_on() because saz/resolv_conf is not often published on forge
modname = 'resolv_conf'
giturl = "https://github.com/saz/puppet-#{modname}.git"
on host, puppet("resource exec 'git clone #{modname}' command='git clone #{giturl} /etc/puppetlabs/code/environments/production/modules/#{modname}' path=/usr/bin")
end
hosts_as('master').each do |master|
pp = <<-EOS
exec { 'set master /etc/hosts':
path => '/bin/',
command => 'echo -e "127.0.0.1 ipa-server-1.example.lan ipa-server-1\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 #{ip_master} ipa-server-1.example.lan ipa-server-1\n" > /etc/hosts',
}
EOS
apply_manifest_on(master, pp, catch_failures: true, debug: true)
#
# # install_module_from_forge_on(host, 'saz-resolv_conf', '>= 4.0.0 < 5.0.0')
# # we need to not use function install_module_from_forge_on() because saz/resolv_conf is not often published on forge
# modname = 'resolv_conf'
# giturl = "https://github.com/saz/puppet-#{modname}.git"
# on host, puppet("resource exec 'git clone #{modname}' command='git clone #{giturl} /etc/puppetlabs/code/environments/production/modules/#{modname}' path=/usr/bin")
end
hosts_as('replica').each do |replica|
ip_replica = fact_on('replica', 'networking.interfaces.eth1.ip')
pp = <<-EOS
exec { 'set replica /etc/hosts':
path => '/bin/',
command => 'echo -e "127.0.0.1 ipa-server-2.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 #{ip_replica} ipa-server-2.example.lan ipa-server-2\n" > /etc/hosts',
}
class { 'resolv_conf':
nameservers => ['#{ip_master}'],
}
host {'ipa-server-1.example.lan':
ensure => present,
ip => '#{ip_master}',
}
EOS
apply_manifest_on(replica, pp, catch_failures: true, debug: 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.
# Configure all clients nodes.
hosts_as('client').each do |client|
ip_client = fact_on('client', 'networking.interfaces.enp0s8.ip')
pp = <<-EOS
exec { 'set client ubuntu /etc/hosts':
path => '/bin/',
command => 'echo -e "127.0.0.1 #{client}.example.lan #{client}\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 #{ip_client} #{client}.example.lan #{client}\n" > /etc/hosts',
}
class { 'resolv_conf':
nameservers => ['#{ip_master}'],
}
host {'ipa-server-1.example.lan':
ensure => present,
ip => '#{ip_master}',
}
EOS
apply_manifest_on(client, pp, catch_failures: true)
end
# hosts_as('master').each do |master|
# pp = <<-EOS
# exec { 'set master /etc/hosts':
# path => '/bin/',
# command => 'echo -e "127.0.0.1 ipa-server-1.example.lan ipa-server-1\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 #{ip_master} ipa-server-1.example.lan ipa-server-1\n" > /etc/hosts',
# }
# EOS
#
# apply_manifest_on(master, pp, catch_failures: true, debug: true)
# end
#
# hosts_as('replica').each do |replica|
# ip_replica = fact_on('replica', 'networking.interfaces.eth1.ip')
# pp = <<-EOS
# exec { 'set replica /etc/hosts':
# path => '/bin/',
# command => 'echo -e "127.0.0.1 ipa-server-2.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 #{ip_replica} ipa-server-2.example.lan ipa-server-2\n" > /etc/hosts',
# }
# class { 'resolv_conf':
# nameservers => ['#{ip_master}'],
# }
# host {'ipa-server-1.example.lan':
# ensure => present,
# ip => '#{ip_master}',
# }
# EOS
#
# apply_manifest_on(replica, pp, catch_failures: true, debug: 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.
#
# # Configure all clients nodes.
# hosts_as('client').each do |client|
# ip_client = fact_on('client', 'networking.interfaces.enp0s8.ip')
# pp = <<-EOS
# exec { 'set client ubuntu /etc/hosts':
# path => '/bin/',
# command => 'echo -e "127.0.0.1 #{client}.example.lan #{client}\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 #{ip_client} #{client}.example.lan #{client}\n" > /etc/hosts',
# }
# class { 'resolv_conf':
# nameservers => ['#{ip_master}'],
# }
# host {'ipa-server-1.example.lan':
# ensure => present,
# ip => '#{ip_master}',
# }
# EOS
#
# apply_manifest_on(client, pp, catch_failures: true)
# end
# Configure all centos nodes
hosts_as('centos').each do |centos|
......
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