Skip to content
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
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ easyapache recompile if a change is detected with the configuration file.
###cpanel::tweaksettings
Allows you to pass key => value pairs for the cpanel.config file and
automatically updates your tweak settings if a change is detected.
(note: some keys in the cpanel.config do not have values, this puppet module does not support those options at this time)

###cpanel::updatephpini
Allows you to pass key => value pairs for php.ini and automatically restarts apache to apply the changes only if the values are changed

###cpanel::baseconfig
Allows you to pass a set options to update the /etc/wwacct.conf file
Expand All @@ -38,6 +42,16 @@ Examples
},
email => 'scott@cpanel.net'
}

cpanel::updatephpini { 'puppet':
options => {
'post_max_size' => '64M',
'max_execution_time' => '60',
'memory_limit' => '96M',
'max_input_time' => '60',
'upload_max_filesize' => '64M',
},
}

cpanel::baseconfig { 'puppet':
ns => 'test-a.cpanel.net',
Expand Down
39 changes: 39 additions & 0 deletions cpanel/files/cpanel.aug
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
(*
Module: CPanel
Parses cpanel.config

Author: Raphael Pinson <raphink@gmail.com>

About: Reference
This lens parses cpanel.config files

About: License
This file is licenced under the LGPL v2+, like the rest of Augeas.

About: Lens Usage
To be documented

About: Configuration files
This lens applies to cpanel.config files. See <filter>.

About: Examples
The <Test_CPanel> file contains various examples and tests.
*)
module CPanel =

autoload xfm

(* View: kv
A key-value pair, supporting flags and empty values *)
let kv = [ key /[A-Za-z0-9:_.-]+/
. (Sep.equal . store (Rx.space_in?))?
. Util.eol ]

(* View: lns
The <CPanel> lens *)
let lns = (Util.comment | Util.empty | kv)*

(* View: filter *)
let filter = incl "/var/cpanel/cpanel.config"

let xfm = transform lns filter
31 changes: 28 additions & 3 deletions cpanel/manifests/cpanel.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
}
}
define tweaksetting( $options, $email ) {
file { '/usr/share/augeas/lenses/dist/cpanel.aug':
ensure => 'file',
mode => 644,
source => 'puppet:///modules/cpanel/cpanel.aug',
owner => 'root',
group => 'root',
}
internalupdatecpanelconfig { [ hash_keys($options) ]:
options => $options
}
Expand All @@ -29,11 +36,29 @@
}
define internalupdatecpanelconfig( $options ) {
augeas { $title:
lens => 'PHP.lns',
lens => 'CPanel.lns',
incl => '/var/cpanel/cpanel.config',
Copy link
Author

Choose a reason for hiding this comment

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

The lens include is not likely required since it is in the Lens source file but it doesn't hurt to add it.

context => '/files/var/cpanel/cpanel.config/.anon',
changes => "set ${title} ${options[$title]}",
notify => Exec['runtweaksetting']
notify => Exec['runtweaksetting'],
require => File['/usr/share/augeas/lenses/dist/cpanel.aug'],
}
}
define updatephpini ( $options ) {
internalupdatephpini { [ hash_keys($options) ]:
options => $options
}~>
service { 'cpanel_httpd':
name => 'httpd',
ensure => 'true',
enable => 'true',
}
}
define internalupdatephpini( $options ) {
augeas { $title:
lens => 'PHP.lns',
incl => '/usr/local/lib/php.ini',
context => "/files/usr/local/lib/php.ini/PHP",
changes => "set ${title} ${options[$title]}",
}
}
define baseconfig(
Expand Down