Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Aix support #176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions data/os/AIX.yaml
Original file line number Diff line number Diff line change
@@ -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: '<package_location>'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a real value like /opt/freeware/src/packages or /tmp so that the module can be tested.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is possible, because it is up to the user to put the file on the system. It could be on nfs or any other directory and is up to the user to specify where that is. I could just put /tmp but this will likely be wrong for the user but I suppose the way it is now is also wrong.

2 changes: 2 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ defaults:
data_hash: yaml_data

hierarchy:
- name: "Operating System"
path: "os/%{operatingsystem}.yaml"
- name: "Common Data"
path: "common.yaml"
16 changes: 14 additions & 2 deletions manifests/base.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
if $rsyslog::manage_package {
package { $rsyslog::package_name:
ensure => $rsyslog::package_version,
source => $rsyslog::package_source,
}
}

Expand All @@ -43,6 +44,17 @@
}
}

if $rsyslog::switch_default_syslog {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of this param which calls an exec that only makes sense on AIX, suggest conditional logic based off of the platform such as

if $facts['os']['name'] == 'AIX' {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I change to your suggestion it would mean that the following command would run every puppet run trying to do a idempotent check: odmget -q \"subsysname = 'syslogd'\" SRCsubsys | grep rsyslog. This is not a desirable behavior.

Additionally, some users want this module to install rsyslog but also want to control when syslog is changed over to rsyslog. AFAIK, rsyslog is not the default for AIX.

I did update to use if $rsyslog::switch_default_syslog and $::facts['os']['name'] == 'AIX' { to prevent any accidental usage from non AIX systems.

# Manage package must be set to true
# For AIX only
exec{'switch_to_rsyslog':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit:

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 => {
Expand All @@ -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,
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/component/lookup_table.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}

Expand Down
4 changes: 2 additions & 2 deletions manifests/generate_concat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
}
Expand Down
12 changes: 12 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest removing this param as it would only be used by AIX

) {
if $manage_service == true and $external_service == true {
fail('manage_service and external_service cannot be set at the same time!')
Expand Down
7 changes: 7 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@
"operatingsystemrelease": [
"32"
]
},
{
"operatingsystem": "AIX",
"operatingsystemrelease": [
"7.1",
"7.2"
]
}
],
"dependencies": [
Expand Down