From 7ed88f0b726abac3f80d1c89ebcd775be8537e63 Mon Sep 17 00:00:00 2001 From: Corey Osman Date: Wed, 13 Jan 2021 16:31:42 -0800 Subject: [PATCH] Add Aix support * Previously this module kinda supported AIX but had a few issues. This code adds better support and allows the user to control how the rsyslog package is installed and where from. AIX is still considered experimental but it works on several systems tested. --- data/os/AIX.yaml | 8 ++++++++ hiera.yaml | 2 ++ manifests/base.pp | 16 ++++++++++++++-- manifests/component/lookup_table.pp | 4 ++-- manifests/generate_concat.pp | 4 ++-- manifests/init.pp | 12 ++++++++++++ metadata.json | 7 +++++++ 7 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 data/os/AIX.yaml diff --git a/data/os/AIX.yaml b/data/os/AIX.yaml new file mode 100644 index 00000000..1aef40af --- /dev/null +++ b/data/os/AIX.yaml @@ -0,0 +1,8 @@ +--- +rsyslog::package_name: rsyslog.base +rsyslog::group_name: system +rsyslog::service_name: syslogd +rsyslog::switch_default_syslog: true +# you will need to fill the source out +# aix has no yum like service +rsyslog::package_source: '' diff --git a/hiera.yaml b/hiera.yaml index 94f40412..88e969ba 100644 --- a/hiera.yaml +++ b/hiera.yaml @@ -6,5 +6,7 @@ defaults: data_hash: yaml_data hierarchy: + - name: "Operating System" + path: "os/%{operatingsystem}.yaml" - name: "Common Data" path: "common.yaml" diff --git a/manifests/base.pp b/manifests/base.pp index 0f4c1ab3..2970933c 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -33,6 +33,7 @@ if $rsyslog::manage_package { package { $rsyslog::package_name: ensure => $rsyslog::package_version, + source => $rsyslog::package_source, } } @@ -43,6 +44,17 @@ } } + if $rsyslog::switch_default_syslog { + # Manage package must be set to true + # For AIX only + exec{'switch_to_rsyslog': + command => 'syslog_ssw -r', + path => ['/usr/bin','/usr/sbin'], + unless => "odmget -q \"subsysname = 'syslogd'\" SRCsubsys | grep rsyslog", + require => Package[$rsyslog::package_name], + } + } + if $rsyslog::manage_confdir { $purge_params = $rsyslog::purge_config_files ? { true => { @@ -61,8 +73,8 @@ file { $rsyslog::confdir: ensure => directory, - owner => 'root', - group => 'root', + owner => $rsyslog::owner_name, + group => $rsyslog::group_name, mode => $rsyslog::confdir_permissions, * => $purge_params + $require_package, } diff --git a/manifests/component/lookup_table.pp b/manifests/component/lookup_table.pp index c5b841da..f9bf6fbd 100644 --- a/manifests/component/lookup_table.pp +++ b/manifests/component/lookup_table.pp @@ -20,8 +20,8 @@ file { "rsyslog::component::lookup_table_json::${title}": path => $_json_file, content => inline_template('<%= JSON.pretty_generate @lookup_json %>'), - owner => 'root', - group => 'root', + owner => $rsyslog::owner_name, + group => $rsyslog::group_name, mode => '0644', } diff --git a/manifests/generate_concat.pp b/manifests/generate_concat.pp index c667676b..6b969b22 100644 --- a/manifests/generate_concat.pp +++ b/manifests/generate_concat.pp @@ -5,7 +5,7 @@ if $rsyslog::manage_service or $rsyslog::external_service { if ! defined(Concat["${confdir}/${target}"]) { concat { "${confdir}/${target}": - owner => 'root', + owner => $rsyslog::owner_name, notify => Service[$rsyslog::service_name], order => 'numeric', mode => $rsyslog::conf_permissions, @@ -14,7 +14,7 @@ } else { if ! defined(Concat["${confdir}/${target}"]) { concat { "${confdir}/${target}": - owner => 'root', + owner => $rsyslog::owner_name, order => 'numeric', mode => $rsyslog::conf_permissions, } diff --git a/manifests/init.pp b/manifests/init.pp index 13a55cc5..451b4bb3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -85,6 +85,14 @@ # Set the file mode for the rsyslog.d configuration directory. # @param global_conf_perms # Set the file mode for the /etc/rsyslog.conf +# @param owner_name +# Set the owner name for rsyslog configuration files. +# @param group_name +# Set the group name for rsyslog configuration files. +# @param AIX_switch_syslog +# Set the rsyslog switch to false. +# @param package_source +# Required for AIX to specify package source. # class rsyslog ( String $confdir, @@ -115,9 +123,13 @@ Integer $ruleset_priority, Integer $filter_priority, String $target_file, + Optional[Stdlib::Absolutepath] $package_source = undef, Stdlib::Filemode $conf_permissions = '0644', Stdlib::Filemode $confdir_permissions = '0755', Stdlib::Filemode $global_conf_perms = $conf_permissions, + String $owner_name = 'root', + String $group_name = 'root', + Boolean $switch_default_syslog = false, ) { if $manage_service == true and $external_service == true { fail('manage_service and external_service cannot be set at the same time!') diff --git a/metadata.json b/metadata.json index 6f116f7a..15cf1eab 100644 --- a/metadata.json +++ b/metadata.json @@ -54,6 +54,13 @@ "operatingsystemrelease": [ "32" ] + }, + { + "operatingsystem": "AIX", + "operatingsystemrelease": [ + "7.1", + "7.2" + ] } ], "dependencies": [