Faidon Liambotis has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/350773 )
Change subject: Add a new interface::alias definition
......................................................................
Add a new interface::alias definition
Add a new interface::alias definition that can be used to add secondary
IPs (like service IPs) to host interfaces. This is a light wrapper
around interface::ip, but with the following things hardcoded:
- It uses $facts['interface_primary'] for the $interface by default (but
leaves it configurable). No more "eth0" all over the tree.
- It gets both an IPv4 and IPv6 argument, as in the majority of the
existing cases in the tree, users want to pass both and this makes it
easier (both are optional).
- It uses /32 and /128 for IPv4 and IPv6 as the prefix length
respectively. This is not configurable.
Use it for the wiki-mail-eqiad and wiki-mail-codfw service IPs to
demonstrate that it works. More patches will follow.
Change-Id: I26a0f6d882fb25bb6603779afdc878ce867b2713
---
M manifests/site.pp
A modules/interface/manifests/alias.pp
2 files changed, 31 insertions(+), 24 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/73/350773/1
diff --git a/manifests/site.pp b/manifests/site.pp
index bf2d5be..6b9057f 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -2172,18 +2172,9 @@
include ::standard
interface::add_ip6_mapped { 'main': }
- interface::ip { 'wiki-mail-eqiad.wikimedia.org_v4':
- interface => 'eth0',
- address => '208.80.154.91',
- prefixlen => '32',
- }
-
- interface::ip { 'wiki-mail-eqiad.wikimedia.org_v6':
- interface => 'eth0',
- address => '2620:0:861:3:208:80:154:91',
- prefixlen => '128',
- # mark as deprecated = never pick this address unless explicitly asked
- options => 'preferred_lft 0',
+ interface::alias { 'wiki-mail-eqiad.wikimedia.org':
+ ipv4 => '208.80.154.91',
+ ipv6 => '2620:0:861:3:208:80:154:91',
}
}
@@ -2192,18 +2183,9 @@
include ::standard
interface::add_ip6_mapped { 'main': }
- interface::ip { 'wiki-mail-codfw.wikimedia.org_v4':
- interface => 'eth0',
- address => '208.80.153.46',
- prefixlen => '32',
- }
-
- interface::ip { 'wiki-mail-codfw.wikimedia.org_v6':
- interface => 'eth0',
- address => '2620:0:860:2:208:80:153:46',
- prefixlen => '128',
- # mark as deprecated = never pick this address unless explicitly asked
- options => 'preferred_lft 0',
+ interface::alias { 'wiki-mail-codfw.wikimedia.org':
+ ipv4 => '208.80.153.46',
+ ipv6 => '2620:0:860:2:208:80:153:46',
}
}
diff --git a/modules/interface/manifests/alias.pp
b/modules/interface/manifests/alias.pp
new file mode 100644
index 0000000..364713e
--- /dev/null
+++ b/modules/interface/manifests/alias.pp
@@ -0,0 +1,25 @@
+# Simplified version of interface::ip, only used for adding secondary IPs to
hosts
+#
+define interface::alias(
+ $interface=$facts['interface_primary'],
+ $ipv4=undef,
+ $ipv6=undef,
+) {
+ if $ipv4 != undef {
+ interface::ip { "${title} ipv4":
+ interface => $interface,
+ address => $ipv4,
+ prefixlen => 32,
+ }
+ }
+
+ if $ipv6 != undef {
+ interface::ip { "${title} ipv6":
+ interface => $interface,
+ address => $ipv6,
+ prefixlen => 128,
+ # mark as deprecated = never pick this address unless explicitly
asked
+ options => 'preferred_lft 0',
+ }
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/350773
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I26a0f6d882fb25bb6603779afdc878ce867b2713
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits