coren has submitted this change and it was merged.
Change subject: RDoc for tcpircbot class and tcpircbot::instance resource
......................................................................
RDoc for tcpircbot class and tcpircbot::instance resource
Also parametrizes 'cidr' configuration option.
Change-Id: Iaf0fc648c7700dc234a3bcf49cfbd56521d381b9
---
M modules/tcpircbot/manifests/init.pp
M modules/tcpircbot/manifests/instance.pp
M modules/tcpircbot/templates/tcpircbot.json.erb
3 files changed, 81 insertions(+), 11 deletions(-)
Approvals:
coren: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/tcpircbot/manifests/init.pp
b/modules/tcpircbot/manifests/init.pp
index 96a6bc5..a3429f1 100644
--- a/modules/tcpircbot/manifests/init.pp
+++ b/modules/tcpircbot/manifests/init.pp
@@ -1,20 +1,35 @@
-# Listens on a TCP port and forwards messages to an IRC channel.
-# Connects to freenode via SSL and listens on TCP port 9200 by default.
+# == Class: tcpircbot
#
-# Example:
+# Base class for tcpircbot, a daemon that reads messages from a TCP socket and
+# writes them to an IRC channel. You should not need to override the defaults
+# for this class's parameters. You likely need to simply 'include tcpircbot'
+# and then provision an instance by declaring a 'tcpircbot::instance' resource.
+# See instance.pp for the configuration options you do need to specify.
#
-# include tcpircbot
+# === Parameters
#
-# tcpircbot::instance { 'announcebot':
-# password => 'nickserv_secret123',
-# channel => '#wikimedia-operations',
-# }
+# [*user*]
+# Run tcpircbot instances as this system user (default: 'tcpircbot').
#
-# You can test it like this:
+# [*group*]
+# Run tcpircbot under this gid (default: 'tcpircbot').
#
-# nc localhost 9200 <<<"Hello, IRC!"
+# [*dir*]
+# Directory for tcpircbot script and configuration files and home directory
+# for user.
#
-# Logs to /var/log/upstart/tcpircbot-*.log
+# === Examples
+#
+# The following snippet will configure a bot nicknamed 'announcebot' that will
+# sit on #wikimedia-operations on Freenode and forward messages that come in
from
+# private and loopback IPs on port 9200:
+#
+# include tcpircbot
+#
+# tcpircbot::instance { 'announcebot':
+# channel => '#wikimedia-operations',
+# password => $passwords::irc::announcebot,
+# }
#
class tcpircbot (
$user = 'tcpircbot',
diff --git a/modules/tcpircbot/manifests/instance.pp
b/modules/tcpircbot/manifests/instance.pp
index 1433f93..aede997 100644
--- a/modules/tcpircbot/manifests/instance.pp
+++ b/modules/tcpircbot/manifests/instance.pp
@@ -1,9 +1,63 @@
+# == Define: tcpircbot::instance
+#
+# Provisions a daemon that maintains a connection to IRC and listens on a
+# server socket. Data read from the socket is forwarded to an IRC channel.
+#
+# === Parameters
+#
+# [*channel*]
+# Echo read messages to this IRC channel.
+#
+# [*nickname*]
+# Bot's preferred IRC nick. Should be registered with nickserv. Defaults to
+# the resource's title.
+#
+# [*password*]
+# Nickserv password for bot's nickname. The bot uses SASL to authenticate
+# itself with nickserv.
+#
+# [*server_host*]
+# Hostname of IRC server to which the bot should connect (default:
+# 'chat.freenode.net').
+#
+# [*server_port*]
+# IRC server's port (default: 7000).
+#
+# [*cidr*]
+# IPv6 CIDR range. Optional. If defined, inbound connections from addresses
+# outside this range will be rejected. If not defined (the default), the
+# service will only accept connections from private and loopback IPs.
+# Example: "fc00::/7".
+#
+# [*ssl*]
+# Whether to use SSL to connect to IRC server (default: true).
+#
+# [*max_clients*]
+# Maximum number of simultaneous inbound connections (default: 5).
+#
+# [*listen_port*]
+# Port to listen on for messages (default: 9200).
+#
+# === Examples
+#
+# The following snippet will configure a bot nicknamed 'announcebot' that will
+# sit on #wikimedia-operations on Freenode and forward messages that come in
from
+# private and loopback IPs on port 9200:
+#
+# include tcpircbot
+#
+# tcpircbot::instance { 'announcebot':
+# channel => '#wikimedia-operations',
+# password => $passwords::irc::announcebot,
+# }
+#
define tcpircbot::instance(
$channel,
$password,
$nickname = $title,
$server_host = 'chat.freenode.net',
$server_port = 7000,
+ $cidr = undef,
$ssl = true,
$max_clients = 5,
$listen_port = 9200,
diff --git a/modules/tcpircbot/templates/tcpircbot.json.erb
b/modules/tcpircbot/templates/tcpircbot.json.erb
index 8c4a82a..fb7070e 100755
--- a/modules/tcpircbot/templates/tcpircbot.json.erb
+++ b/modules/tcpircbot/templates/tcpircbot.json.erb
@@ -7,6 +7,7 @@
},
"tcp": {
"max_clients": <%= @max_clients %>,
+ <% if @cidr %>"cidr": "<%= @cidr %>",<% end %>
"port": <%= @listen_port %>
}
}
--
To view, visit https://gerrit.wikimedia.org/r/61432
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf0fc648c7700dc234a3bcf49cfbd56521d381b9
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ryan Lane <[email protected]>
Gerrit-Reviewer: coren <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits