Giuseppe Lavagetto has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/339415 )
Change subject: profile::conftool::client: first commit
......................................................................
profile::conftool::client: first commit
The current classes under the conftool:: hierarchy are an unholy mess.
This is the first patch to correct that situation.
Change-Id: I406af20dfe8c00bc9001147d531cbd492a076837
---
A modules/conftool/manifests/config.pp
M modules/etcd/templates/client_config.erb
A modules/profile/manifests/conftool/client.pp
3 files changed, 83 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/15/339415/1
diff --git a/modules/conftool/manifests/config.pp
b/modules/conftool/manifests/config.pp
new file mode 100644
index 0000000..2441a92
--- /dev/null
+++ b/modules/conftool/manifests/config.pp
@@ -0,0 +1,25 @@
+class conftool::config ($namespace, $tcpircbot_host, $tcpircbot_port, $hosts =
[]) {
+ file { '/etc/conftool':
+ ensure => directory,
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ }
+
+ file { '/etc/conftool/config.yaml':
+ ensure => present,
+ owner => 'root',
+ group => 'root',
+ mode => '0444',
+ content => ordered_yaml({
+ hosts => $hosts,
+ tcpircbot_host => $tcpircbot_host,
+ tcpircbot_port => $tcpircbot_port,
+ driver_options => {
+ allow_reconnect => true,
+ },
+ namespace => $namespace,
+ }),
+ }
+
+}
diff --git a/modules/etcd/templates/client_config.erb
b/modules/etcd/templates/client_config.erb
index 338c6bf..9d555bd 100644
--- a/modules/etcd/templates/client_config.erb
+++ b/modules/etcd/templates/client_config.erb
@@ -1,5 +1,5 @@
<% @settings.keys.sort.each do |k| -%>
-<%- if @settings[k] != :undef -%>
+<%- if @settings[k] != :undef and @settings[k] != '' -%>
<%= k %>: <%= @settings[k] %>
<%- end -%>
<% end %>
diff --git a/modules/profile/manifests/conftool/client.pp
b/modules/profile/manifests/conftool/client.pp
new file mode 100644
index 0000000..7f40ee8
--- /dev/null
+++ b/modules/profile/manifests/conftool/client.pp
@@ -0,0 +1,57 @@
+#
+# == Class profile::conftool::client
+#
+# Configures a server to be a conftool client, setting up
+#
+# - The etcd client configuration in /etc/etcd/etcdrc
+# - The conftool client configuration
+# - The etcd credentials for the root user in /root/.etcdrc
+#
+class profile::conftool::client(
+ $srv_dns = hiera('etcd::srv_dns'),
+ $host = hiera('etcd::host'),
+ $port = hiera('etcd::port'),
+ $root_password = hiera('etcd::auth::common::root_password'),
+ $tcpircbot_host = hiera('profile::conftool::client::tcpircbot_host')
+ $tcpircbot_port = hiera('profile::conftool::client::tcpircbot_port'),
+ $namespace = hiera('profile::conftool::client::namespace')
+) {
+ require_package('python-conftool')
+
+ class { '::etcd::client::globalconfig':
+ srv_dns => $srv_dns,
+ host => $host,
+ port => $port,
+ protocol => 'https',
+ }
+
+ ::etcd::client::config { '/root/.etcdrc',
+ settings => {
+ username => 'root',
+ password => $root_password,
+ },
+ }
+
+ file { '/etc/conftool/config.yaml':
+ ensure => present,
+ owner => 'root',
+ group => 'root',
+ mode => '0444',
+ content => ordered_yaml({
+ hosts => $hosts,
+ tcpircbot_host => $tcpircbot_host,
+ tcpircbot_port => $tcpircbot_port,
+ driver_options => {
+ allow_reconnect => true,
+ },
+ namespace => $namespace,
+ }),
+ }
+
+ ::conftool::config {
+ namespace => $namespace,
+ tcpircbot_host => $tcpircbot_host,
+ tcpircbot_port => $tcpircbot_port,
+ hosts => [],
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/339415
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I406af20dfe8c00bc9001147d531cbd492a076837
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits