summaryrefslogtreecommitdiffstats
path: root/zarb-ml/mageia-sysadm/2010-November/000534.html
blob: 86e759f03411fe2d96922e16ec2fe6ae354a144d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [Mageia-sysadm] Keep puppet module generic without hardcoding	domain name
   </TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20Keep%20puppet%20module%20generic%20without%20hardcoding%0A%09domain%20name&In-Reply-To=%3C1289840626.722.145.camel%40akroma.ephaone.org%3E">
   <META NAME="robots" CONTENT="index,nofollow">
   <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
   <LINK REL="Previous"  HREF="000529.html">
   <LINK REL="Next"  HREF="000535.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[Mageia-sysadm] Keep puppet module generic without hardcoding	domain name</H1>
    <B>Michael Scherer</B> 
    <A HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20Keep%20puppet%20module%20generic%20without%20hardcoding%0A%09domain%20name&In-Reply-To=%3C1289840626.722.145.camel%40akroma.ephaone.org%3E"
       TITLE="[Mageia-sysadm] Keep puppet module generic without hardcoding	domain name">misc at zarb.org
       </A><BR>
    <I>Mon Nov 15 18:03:46 CET 2010</I>
    <P><UL>
        <LI>Previous message: <A HREF="000529.html">[Mageia-sysadm] [254] Add params file
</A></li>
        <LI>Next message: <A HREF="000535.html">[Mageia-sysadm] Backups
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#534">[ date ]</a>
              <a href="thread.html#534">[ thread ]</a>
              <a href="subject.html#534">[ subject ]</a>
              <a href="author.html#534">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>Hi,

Looking after most commits, I see that we often hardcode the domain name
in the puppet manifest and template.

I think we should avoid for various reasons :

- hard coding anything is never good

- if one day we fork again, or if we are forced to change project name
( both have occurred in the past for mandriva, so maybe we could be
proactive this time ), this would be easier for us ( or them, depending
on the side of the fork we are ).

- this greatly enhance the module reusability ( IE, I cut and past some
module that I use on my server )

- this is not really complex to achieve, thanks to templating

and the more important reason :

- this allow us to set up test VMs/servers without fiddling with DNS too
much, and prevent stupid errors ( like changing /etc/hosts and
forgetting this was changed ). 


  
So, if you agree with me, and if you see mageia.org in some templates
files ( except in bind for obvious reason ), just replace this with &lt;%=
domain %&gt;. See for example commit 221.

This is the ERB syntax ( erb being the template engine of ruby and
puppet ) for expanding the variable, see
<A HREF="http://en.wikipedia.org/wiki/ERuby">http://en.wikipedia.org/wiki/ERuby</A>

The list of variable to use can be found with the facter command.

And for the ldap dc=mageia,dc=org, we can either add a variable to
facter ( this would be cleaner, but more complex
<A HREF="http://projects.puppetlabs.com/projects/1/wiki/Adding_Facts">http://projects.puppetlabs.com/projects/1/wiki/Adding_Facts</A> ), or use
this in the template :

&lt;%
dc_suffix = 'dc=' + domain.gsub('.',',dc=')
%&gt;

&lt;%= dc_suffix %&gt;

See commit 211 for example on how do this.


Of course, if there is something I missed, do not hesitate to tell. 
-- 
Michael Scherer

</PRE>












<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="000529.html">[Mageia-sysadm] [254] Add params file
</A></li>
	<LI>Next message: <A HREF="000535.html">[Mageia-sysadm] Backups
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#534">[ date ]</a>
              <a href="thread.html#534">[ thread ]</a>
              <a href="subject.html#534">[ subject ]</a>
              <a href="author.html#534">[ author ]</a>
         </LI>
       </UL>

<hr>
<a href="https://www.mageia.org/mailman/listinfo/mageia-sysadm">More information about the Mageia-sysadm
mailing list</a><br>
</body></html>