Skip to content

Commit

Permalink
(PE-12002) Add AIX support
Browse files Browse the repository at this point in the history
This change adds puppet agent support for AIX.

Support is gated by the 'aix' operatingsystem fact
and an archetecture fact matching 'PowerPC_POWER[5,6,7]'.

This change uses the same strategy as osx for removing
unused packages as aix doesn't have fully fledged package
management for rpms.
  • Loading branch information
mwbutcher committed Dec 18, 2015
1 parent 075bca1 commit 0c5747c
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 2 deletions.
5 changes: 4 additions & 1 deletion manifests/init.pp
Expand Up @@ -21,7 +21,7 @@
$source = $::puppet_agent::params::_source,
) inherits ::puppet_agent::params {

validate_re($arch, ['^x86$','^x64$','^i386$','^i86pc$','^amd64$','^x86_64$','^power$', '^sun4[uv]$'])
validate_re($arch, ['^x86$','^x64$','^i386$','^i86pc$','^amd64$','^x86_64$','^power$','^sun4[uv]$','PowerPC_POWER'])

if versioncmp("${::clientversion}", '3.8.0') < 0 {
fail('upgrading requires Puppet 3.8')
Expand Down Expand Up @@ -49,6 +49,9 @@
}
} elsif $::operatingsystem == 'Darwin' and $::macosx_productversion_major =~ '10\.[9,10,11]' {
$_package_file_name = "${puppet_agent::package_name}-${puppet_agent::params::master_agent_version}-1.osx${$::macosx_productversion_major}.dmg"
} elsif $::operatingsystem == 'aix' and $::architecture =~ 'PowerPC_POWER[5,6,7]' {
$aix_ver_number = regsubst($::architecture,'PowerPC_POWER(\d+)$','\1')
$_package_file_name = "${puppet_agent::package_name}-${puppet_agent::params::master_agent_version}-1.aix${aix_ver_number}.1.ppc.rpm"
} else {
$_package_file_name = undef
}
Expand Down
17 changes: 17 additions & 0 deletions manifests/install.pp
Expand Up @@ -45,6 +45,23 @@
source => "/opt/puppetlabs/packages/${package_file_name}",
require => Class['puppet_agent::install::remove_packages'],
}
} elsif $::operatingsystem == 'AIX' and $::architecture =~ 'PowerPC_POWER[5,6,7]' {
contain puppet_agent::install::remove_packages

exec { 'replace puppet.conf removed by package removal':
path => '/bin:/usr/bin:/sbin:/usr/sbin',
command => "cp ${puppet_agent::params::confdir}/puppet.conf.rpmsave ${puppet_agent::params::config}",
creates => $puppet_agent::params::config,
require => Class['puppet_agent::install::remove_packages'],
before => Package[$puppet_agent::package_name],
logoutput => 'on_failure',
}

$_package_options = {
source => "/opt/puppetlabs/packages/${package_file_name}",
require => Class['puppet_agent::install::remove_packages'],
provider => 'rpm',
}
} else {
$_package_options = {}
}
Expand Down
4 changes: 4 additions & 0 deletions manifests/install/remove_packages.pp
Expand Up @@ -13,6 +13,10 @@

contain '::puppet_agent::install::remove_packages_osx'

} elsif $::operatingsystem == 'AIX' {

contain '::puppet_agent::install::remove_packages_aix'

} else {

$package_options = $::operatingsystem ? {
Expand Down
50 changes: 50 additions & 0 deletions manifests/install/remove_packages_aix.pp
@@ -0,0 +1,50 @@
# == Class puppet_agent::install::remove_packages_aix
#
# Sadly, special handling is required to clear up puppet_enterprise installation
# on 3.8.
#
class puppet_agent::install::remove_packages_aix {
assert_private()

if $::puppet_agent::is_pe {
# shutdown services
service { 'pe-puppet':
ensure => stopped,
}->
service { 'pe-mcollective':
ensure => stopped,
}->

# remove old users and groups
user { 'pe-puppet':
ensure => absent,
}->
user { 'pe-mcollective':
ensure => absent,
}->

# remove old /opt/puppet files
file { '/opt/puppet':
ensure => absent,
force => true,
backup => false,
}

[
'pe-augeas',
'pe-ruby-augeas',
'pe-openssl',
'pe-ruby',
'pe-facter',
'pe-puppet',
'pe-mcollective',
'pe-hiera',
'pe-libyaml',
].each |$package| {
exec { "remove ${package}":
command => "/usr/bin/rpm -e --nodeps `rpm -qa | grep ${package}`",
require => File['/opt/puppet'],
}
}
}
}
16 changes: 16 additions & 0 deletions manifests/osfamily/aix.pp
@@ -0,0 +1,16 @@
class puppet_agent::osfamily::aix(
$package_file_name = undef,
) {
assert_private()

class { 'puppet_agent::prepare::package':
package_file_name => $package_file_name,
}

contain puppet_agent::prepare::package

file { '/usr/local/bin/puppet':
ensure => 'link',
target => '/opt/puppetlabs/bin/puppet',
}
}
2 changes: 1 addition & 1 deletion manifests/params.pp
Expand Up @@ -22,7 +22,7 @@
}

case $::osfamily {
'RedHat', 'Amazon', 'Debian', 'Suse', 'Solaris', 'Darwin': {
'RedHat', 'Amazon', 'Debian', 'Suse', 'Solaris', 'Darwin', 'AIX': {
$package_name = 'puppet-agent'
$service_names = ['puppet', 'mcollective']

Expand Down

0 comments on commit 0c5747c

Please sign in to comment.