Andrew Bogott has uploaded a new change for review.
https://gerrit.wikimedia.org/r/92339
Change subject: Add a 'generic' module.
......................................................................
Add a 'generic' module.
This is a catch-all for bits of the old manifests/generic-defintions.pp
that had nowhere else to go.
Change-Id: I3a5ef3a200bf0d0722c99ab351ba0be98c1e9de1
---
M manifests/generic-definitions.pp
A modules/generic/README
A modules/generic/manifests/debconf/set.pp
A modules/generic/manifests/higher_min_free_kbytes.pp
A modules/generic/manifests/locales/international.pp
A modules/generic/manifests/system_role.pp
A modules/generic/manifests/systemuser.pp
A modules/generic/manifests/upstart_job.pp
A modules/generic/manifests/wikidev-umask.pp
9 files changed, 132 insertions(+), 135 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/39/92339/1
diff --git a/manifests/generic-definitions.pp b/manifests/generic-definitions.pp
index 43d6b2f..6610e1c 100644
--- a/manifests/generic-definitions.pp
+++ b/manifests/generic-definitions.pp
@@ -2,54 +2,6 @@
#
# File that contains generally useful definitions, e.g. for creating system
users
-# Prints a MOTD message about the role of this system
-define system_role($description, $ensure=present) {
- $role_script_content = "#!/bin/sh
-
-echo \"$(hostname) is a Wikimedia ${description} (${title}).\"
-"
-
- $rolename = regsubst($title, ":", "-", "G")
- $motd_filename = "/etc/update-motd.d/05-role-${rolename}"
-
- if $::lsbdistid == "Ubuntu" and versioncmp($::lsbdistrelease, "9.10")
>= 0 {
- file { $motd_filename:
- owner => root,
- group => root,
- mode => 0555,
- content => $role_script_content,
- ensure => $ensure;
- }
- }
-}
-
-# Creates a system username with associated group, random uid/gid, and
/bin/false as shell
-define systemuser($name, $home=undef, $managehome=true, $shell="/bin/false",
$groups=undef, $default_group=$name, $ensure=present) {
- # FIXME: deprecate $name parameter in favor of just using $title
-
- if $default_group == $name {
- group { $default_group:
- name => $default_group,
- ensure => present;
- }
- }
-
- user { $name:
- require => Group[$default_group],
- name => $name,
- gid => $default_group,
- home => $home ? {
- undef => "/var/lib/${name}",
- default => $home
- },
- managehome => $managehome,
- shell => $shell,
- groups => $groups,
- system => true,
- ensure => $ensure;
- }
-}
-
# Enables a certain Apache 2 site
define apache_site($name, $prefix="", $ensure="link") {
file { "/etc/apache2/sites-enabled/${prefix}${name}":
@@ -123,30 +75,6 @@
}
-# Create a symlink in /etc/init.d/ to a generic upstart init script
-define upstart_job($install="false", $start="false") {
- # Create symlink
- file { "/etc/init.d/${title}":
- ensure => "/lib/init/upstart-job";
- }
-
- if $install == "true" {
- file { "/etc/init/${title}.conf":
- source => "puppet:///files/upstart/${title}.conf"
- }
- }
-
- if $start == "true" {
- exec { "start $title":
- require => File["/etc/init/${title}.conf"],
- subscribe => File["/etc/init/${title}.conf"],
- refreshonly => true,
- command => "start ${title}",
- path => "/bin:/sbin:/usr/bin:/usr/sbin"
- }
- }
-}
-
class generic::gluster-client {
package { "glusterfs-client":
@@ -200,68 +128,5 @@
} else {
# Ubuntu post Lucid ship by default with ant 1.8 or later
package { ["ant"]: ensure => installed; }
- }
-}
-
-# this installs a bunch of international locales, f.e. for "planet" on singer
-class generic::locales::international {
-
- package { 'locales':
- ensure => latest;
- }
-
- file { "/var/lib/locales/supported.d/local":
- source => "puppet:///files/locales/local_int",
- owner => "root",
- group => "root",
- mode => 0444;
- }
-
- exec { "/usr/sbin/locale-gen":
- subscribe => File["/var/lib/locales/supported.d/local"],
- refreshonly => true,
- require => File["/var/lib/locales/supported.d/local"];
- }
-}
-
-# Definition: generic::debconf::set
-# Changes a debconf value
-#
-# Parameters:
-# - $title
-# Debconf setting, e.g. mailman/used_languages
-# - $value
-# The value $title should be set to
-define generic::debconf::set($value) {
- exec { "debconf-communicate set $title":
- path => "/usr/bin:/usr/sbin:/bin:/sbin",
- command => "echo set ${title} \"${value}\" |
debconf-communicate",
- unless => "test \"$(echo get ${title} | debconf-communicate)\"
= \"0 ${value}\""
- }
-}
-
-class generic::wikidev-umask {
-
- # set umask to 0002 for wikidev users, per RT-804
- file {
- "/etc/profile.d/umask-wikidev.sh":
- ensure => present,
- owner => root,
- group => root,
- mode => 0444,
- source =>
"puppet:///files/environment/umask-wikidev-profile-d.sh";
- }
-}
-
-
-class generic::higher_min_free_kbytes {
- # Set a high min_free_kbytes watermark.
- # See https://wikitech.wikimedia.org/wiki/Dataset1001#Feb_8_2012
- # FIXME: Is this setting appropriate to the nodes on which it is
applied? Is
- # the value optimal? Investigate.
- sysctl::parameters { 'higher_min_free_kbytes':
- values => {
- 'vm.min_free_kbytes' => 1024 * 256,
- },
}
}
diff --git a/modules/generic/README b/modules/generic/README
new file mode 100644
index 0000000..498c45f
--- /dev/null
+++ b/modules/generic/README
@@ -0,0 +1,5 @@
+This is an OK place for one-off classes that are used only at WMF.
+
+Still, it's kind of a hack to have a 'generic' module, so please try your
+best to fit your class into another better-organized module before dumping
+it here.
diff --git a/modules/generic/manifests/debconf/set.pp
b/modules/generic/manifests/debconf/set.pp
new file mode 100644
index 0000000..5004408
--- /dev/null
+++ b/modules/generic/manifests/debconf/set.pp
@@ -0,0 +1,15 @@
+# Definition: generic::debconf::set
+# Changes a debconf value
+#
+# Parameters:
+# - $title
+# Debconf setting, e.g. mailman/used_languages
+# - $value
+# The value $title should be set to
+define generic::debconf::set($value) {
+ exec { "debconf-communicate set $title":
+ path => "/usr/bin:/usr/sbin:/bin:/sbin",
+ command => "echo set ${title} \"${value}\" |
debconf-communicate",
+ unless => "test \"$(echo get ${title} | debconf-communicate)\"
= \"0 ${value}\""
+ }
+}
diff --git a/modules/generic/manifests/higher_min_free_kbytes.pp
b/modules/generic/manifests/higher_min_free_kbytes.pp
new file mode 100644
index 0000000..c26968d
--- /dev/null
+++ b/modules/generic/manifests/higher_min_free_kbytes.pp
@@ -0,0 +1,11 @@
+class generic::higher_min_free_kbytes {
+ # Set a high min_free_kbytes watermark.
+ # See https://wikitech.wikimedia.org/wiki/Dataset1001#Feb_8_2012
+ # FIXME: Is this setting appropriate to the nodes on which it is
applied? Is
+ # the value optimal? Investigate.
+ sysctl::parameters { 'higher_min_free_kbytes':
+ values => {
+ 'vm.min_free_kbytes' => 1024 * 256,
+ },
+ }
+}
diff --git a/modules/generic/manifests/locales/international.pp
b/modules/generic/manifests/locales/international.pp
new file mode 100644
index 0000000..35df44e
--- /dev/null
+++ b/modules/generic/manifests/locales/international.pp
@@ -0,0 +1,20 @@
+# this installs a bunch of international locales, f.e. for "planet" on singer
+class generic::locales::international {
+
+ package { 'locales':
+ ensure => latest;
+ }
+
+ file { "/var/lib/locales/supported.d/local":
+ source => "puppet:///files/locales/local_int",
+ owner => "root",
+ group => "root",
+ mode => 0444;
+ }
+
+ exec { "/usr/sbin/locale-gen":
+ subscribe => File["/var/lib/locales/supported.d/local"],
+ refreshonly => true,
+ require => File["/var/lib/locales/supported.d/local"];
+ }
+}
diff --git a/modules/generic/manifests/system_role.pp
b/modules/generic/manifests/system_role.pp
new file mode 100644
index 0000000..9973037
--- /dev/null
+++ b/modules/generic/manifests/system_role.pp
@@ -0,0 +1,20 @@
+# Prints a MOTD message about the role of this system
+define generic::system_role($description, $ensure=present) {
+ $role_script_content = "#!/bin/sh
+
+echo \"$(hostname) is a Wikimedia ${description} (${title}).\"
+"
+
+ $rolename = regsubst($title, ":", "-", "G")
+ $motd_filename = "/etc/update-motd.d/05-role-${rolename}"
+
+ if $::lsbdistid == "Ubuntu" and versioncmp($::lsbdistrelease, "9.10")
>= 0 {
+ file { $motd_filename:
+ owner => root,
+ group => root,
+ mode => 0555,
+ content => $role_script_content,
+ ensure => $ensure;
+ }
+ }
+}
diff --git a/modules/generic/manifests/systemuser.pp
b/modules/generic/manifests/systemuser.pp
new file mode 100644
index 0000000..a9761b9
--- /dev/null
+++ b/modules/generic/manifests/systemuser.pp
@@ -0,0 +1,26 @@
+# Creates a system username with associated group, random uid/gid, and
/bin/false as shell
+define generic::systemuser($name, $home=undef, $managehome=true,
$shell="/bin/false", $groups=undef, $default_group=$name, $ensure=present) {
+ # FIXME: deprecate $name parameter in favor of just using $title
+
+ if $default_group == $name {
+ group { $default_group:
+ name => $default_group,
+ ensure => present;
+ }
+ }
+
+ user { $name:
+ require => Group[$default_group],
+ name => $name,
+ gid => $default_group,
+ home => $home ? {
+ undef => "/var/lib/${name}",
+ default => $home
+ },
+ managehome => $managehome,
+ shell => $shell,
+ groups => $groups,
+ system => true,
+ ensure => $ensure;
+ }
+}
diff --git a/modules/generic/manifests/upstart_job.pp
b/modules/generic/manifests/upstart_job.pp
new file mode 100644
index 0000000..4ed5092
--- /dev/null
+++ b/modules/generic/manifests/upstart_job.pp
@@ -0,0 +1,23 @@
+# Create a symlink in /etc/init.d/ to a generic upstart init script
+define generic::upstart_job($install="false", $start="false") {
+ # Create symlink
+ file { "/etc/init.d/${title}":
+ ensure => "/lib/init/upstart-job";
+ }
+
+ if $install == "true" {
+ file { "/etc/init/${title}.conf":
+ source => "puppet:///files/upstart/${title}.conf"
+ }
+ }
+
+ if $start == "true" {
+ exec { "start $title":
+ require => File["/etc/init/${title}.conf"],
+ subscribe => File["/etc/init/${title}.conf"],
+ refreshonly => true,
+ command => "start ${title}",
+ path => "/bin:/sbin:/usr/bin:/usr/sbin"
+ }
+ }
+}
diff --git a/modules/generic/manifests/wikidev-umask.pp
b/modules/generic/manifests/wikidev-umask.pp
new file mode 100644
index 0000000..61220e7
--- /dev/null
+++ b/modules/generic/manifests/wikidev-umask.pp
@@ -0,0 +1,12 @@
+class generic::wikidev-umask {
+
+ # set umask to 0002 for wikidev users, per RT-804
+ file {
+ "/etc/profile.d/umask-wikidev.sh":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 0444,
+ source =>
"puppet:///files/environment/umask-wikidev-profile-d.sh";
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/92339
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a5ef3a200bf0d0722c99ab351ba0be98c1e9de1
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Andrew Bogott <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits