This repository has been archived by the owner on Dec 1, 2022. It is now read-only.
/
CFEngine_And_OpenWrt.html
303 lines (270 loc) · 17.3 KB
/
CFEngine_And_OpenWrt.html
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<!DOCTYPE html>
<html lang="en" dir="ltr" class="client-nojs">
<head>
<title>CFEngine And OpenWrt - Kyle's Wiki</title>
<meta charset="UTF-8" />
<meta name="generator" content="MediaWiki 1.19.1" />
<link rel="shortcut icon" href="/favicon.ico.html" />
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch_desc.php.html" title="Kyle's Wiki (en)" />
<link rel="EditURI" type="application/rsd+xml" href="http://wiki.xkyle.com/api.php?action=rsd" />
<link rel="copyright" href="http://creativecommons.org/licenses/by-sa/3.0/" />
<link rel="alternate" type="application/atom+xml" title="Kyle's Wiki Atom feed" href="/index.php?title=Special:RecentChanges&feed=atom" />
<link rel="stylesheet" href="http://wiki.xkyle.com/load.php?debug=false&lang=en&modules=mediawiki.legacy.commonPrint%2Cshared%7Cskins.vector&only=styles&skin=vector&*" />
<meta name="ResourceLoaderDynamicStyles" content="" />
<style>a:lang(ar),a:lang(ckb),a:lang(fa),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}a.new,#quickbar a.new{color:#ba0000}
/* cache key: my_wiki:resourceloader:filter:minify-css:7:c88e2bcd56513749bec09a7e29cb3ffa */
</style>
<script src="http://wiki.xkyle.com/load.php?debug=false&lang=en&modules=startup&only=scripts&skin=vector&*"></script>
<script>if(window.mw){
mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"CFEngine_And_OpenWrt","wgTitle":"CFEngine And OpenWrt","wgCurRevisionId":2805,"wgArticleId":421,"wgIsArticle":true,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["CFEngine","OpenWrt"],"wgBreakFrames":false,"wgPageContentLanguage":"en","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgRelevantPageName":"CFEngine_And_OpenWrt","wgRestrictionEdit":[],"wgRestrictionMove":[]});
}</script><script>if(window.mw){
mw.loader.implement("user.options",function($){mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"disablesuggest":0,"editfont":"default","editondblclick":0,"editsection":1,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":0,"extendwatchlist":0,"externaldiff":0,"externaleditor":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"highlightbroken":1,"imagesize":2,"justify":0,"math":1,"minordefault":0,"newpageshidepatrolled":0,"nocache":0,"noconvertlink":0,"norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"quickbar":5,"rcdays":7,"rclimit":50,"rememberpassword":0,"rows":25,"searchlimit":20,"showhiddencats":0,"showjumplinks":1,"shownumberswatching":1,"showtoc":1,"showtoolbar":1,"skin":"vector","stubthreshold":0,"thumbsize":2,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":0,"watchdefault":0,"watchdeletion":0,
"watchlistdays":3,"watchlisthideanons":0,"watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"wllimit":250,"variant":"en","language":"en","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false});;},{},{});mw.loader.implement("user.tokens",function($){mw.user.tokens.set({"editToken":"+\\","watchToken":false});;},{},{});
/* cache key: my_wiki:resourceloader:filter:minify-js:7:9983699ab6150ffa89a90653b2338ac8 */
}</script>
<script>if(window.mw){
mw.loader.load(["mediawiki.page.startup","mediawiki.legacy.wikibits","mediawiki.legacy.ajax"]);
}</script>
<!--[if lt IE 7]><style type="text/css">body{behavior:url("/skins/vector/csshover.min.htc")}</style><![endif]--><!-- start Mixpanel --><script type="text/javascript">(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==
typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");for(g=0;g<i.length;g++)f(c,i[g]);
b._i.push([a,e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);
mixpanel.init("f49fd1e08211929444aad692b8995519");mixpanel.track('pageload')</script><!-- end Mixpanel --></head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-CFEngine_And_OpenWrt skin-vector action-view">
<div id="mw-page-base" class="noprint"></div>
<div id="mw-head-base" class="noprint"></div>
<!-- content -->
<div id="content" class="mw-body">
<a id="top"></a>
<div id="mw-js-message" style="display:none;"></div>
<!-- firstHeading -->
<h1 id="firstHeading" class="firstHeading">
<span dir="auto">CFEngine And OpenWrt</span>
</h1>
<!-- /firstHeading -->
<!-- bodyContent -->
<div id="bodyContent">
<!-- tagline -->
<div id="siteSub">From Kyle's Wiki</div>
<!-- /tagline -->
<!-- subtitle -->
<div id="contentSub"></div>
<!-- /subtitle -->
<!-- jumpto -->
<div id="jump-to-nav" class="mw-jump">
Jump to: <a href="#mw-head">navigation</a>,
<a href="#p-search">search</a>
</div>
<!-- /jumpto -->
<!-- bodycontent -->
<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><p>With a recent patch to include <a href="/CFEngine.html" title="CFEngine" class="mw-redirect">CFEngine</a> in <a href="/Openwrt.html" title="Openwrt" class="mw-redirect">Openwrt</a>, we now have the capability to use CFEngine to manage large systems of openwrt based servers, access points, <a href="/Install_Openwrt_on_a_Seagate_Dockstar.html" title="Install Openwrt on a Seagate Dockstar" class="mw-redirect">Dockstars</a>, whatever! Awesome!
</p>
<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#Installing_CFEngine_on_Openwrt"><span class="tocnumber">1</span> <span class="toctext">Installing CFEngine on Openwrt</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Defining_OpenWRT_Systems_.28class.29_in_CFEngine"><span class="tocnumber">2</span> <span class="toctext">Defining OpenWRT Systems (class) in CFEngine</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#Using_Opkg_to_Manage_Packages"><span class="tocnumber">3</span> <span class="toctext">Using Opkg to Manage Packages</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#TODO"><span class="tocnumber">4</span> <span class="toctext">TODO</span></a></li>
</ul>
</td></tr></table>
<h3> <span class="mw-headline" id="Installing_CFEngine_on_Openwrt"> Installing CFEngine on Openwrt </span></h3>
<p>The <a rel="nofollow" class="external text" href="https://lists.openwrt.org/pipermail/openwrt-devel/2011-May/011023.html">CFEngine patch</a> by Christoph König is not yet integrated into Openwrt Upstream as of this writing. This means compiling it yourself for the platform you need using the Openwrt SDK. If you feel trusting you can download my package built for the <a href="/Dockstar.html" title="Dockstar" class="mw-redirect">Dockstar</a>: <a rel="nofollow" class="external free" href="http://download.xkyle.com/ipkg/cfengine_2.2.10-1_kirkwood.ipk">http://download.xkyle.com/ipkg/cfengine_2.2.10-1_kirkwood.ipk</a>
</p><p><br />
</p>
<h3> <span class="mw-headline" id="Defining_OpenWRT_Systems_.28class.29_in_CFEngine"> Defining OpenWRT Systems (class) in CFEngine </span></h3>
<p>In my update.conf and cfagent.conf, I define a openwrt class first, then I can use that distinction to define other actions later on. Specifically I define my working directory as /etc/cfengine to make sure files go where they are expected:
</p>
<pre>
classes:
openwrt = ( FileExists(/etc/openwrt_release) )
control:
actionsequence = ( copy )
domain = ( YourCompany.com )
policyhost = ( CFengine.YourCompany.com )
sysadm = ( ITguy@YourCompany.com )
# This is with an ubuntu cfengine master server
master_cfinput = ( /var/lib/cfengine2/masterfiles/inputs )
master_cffiles = ( /var/lib/cfengine2/masterfiles/files )
# The openwrt cfengine package likes things to be in /etc/cfengine
openwrt::
repository = ( /etc/cfengine/outputs )
workdir = ( /etc/cfengine/ )
</pre>
<p><br />
</p>
<h3> <span class="mw-headline" id="Using_Opkg_to_Manage_Packages"> Using Opkg to Manage Packages </span></h3>
<pre>
classes:
openwrt::
has_opkg_updates = ( FileExists(/var/opkg-lists/packages) )
control:
openwrt::
DefaultPkgMgr = ( dpkg )
DPKGInstallCommand = ( "/bin/opkg install %s" )
DPKGRemoveCommand = ( "/bin/opkg remove %s" )
packages:
openwrt::
vim-full action=install
shellcommands:
!has_opkg_updates::
"/bin/opkg update"
</pre>
<p>This is not 100% ideal. Depending on your action sequence, you may not get the updated package list <i>before</i> the packages section. Eh, it can wait till next time. Or, this is a wiki, if you have a better solution by all means press the edit button :)
</p><p>Also, since CFEngine was not build with opkg in mind, comparing versions and such don't work. In fact, it can't really even know if something is installed or not, so it just opkg installs everything on your list. Luckily opkg is super fast, so it is not much of a waste.
</p>
<h3> <span class="mw-headline" id="TODO"> TODO </span></h3>
<p>Write a apt-cache for openwrt to fake out cfengine? Patch cfengine to be opkg aware?
</p>
<!--
NewPP limit report
Preprocessor node count: 33/1000000
Post-expand include size: 0/2097152 bytes
Template argument size: 0/2097152 bytes
Expensive parser function count: 0/100
-->
<!-- Saved in parser cache with key my_wiki:pcache:idhash:421-0!*!0!!en!*!* and timestamp 20130921040138 -->
</div> <!-- /bodycontent -->
<!-- printfooter -->
<div class="printfooter">
Retrieved from "<a href="http://wiki.xkyle.com/index.php?title=CFEngine_And_OpenWrt&oldid=2805">http://wiki.xkyle.com/index.php?title=CFEngine_And_OpenWrt&oldid=2805</a>" </div>
<!-- /printfooter -->
<!-- catlinks -->
<div id='catlinks' class='catlinks'><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/Special:Categories.html" title="Special:Categories">Categories</a>: <ul><li><a href="/Category:CFEngine.html" title="Category:CFEngine">CFEngine</a></li><li><a href="/Category:OpenWrt.html" title="Category:OpenWrt">OpenWrt</a></li></ul></div></div> <!-- /catlinks -->
<div class="visualClear"></div>
<!-- debughtml -->
<!-- /debughtml -->
</div>
<!-- /bodyContent -->
</div>
<!-- /content -->
<!-- header -->
<div id="mw-head" class="noprint">
<!-- 0 -->
<div id="p-personal" class="">
<h5>Personal tools</h5>
<ul>
<li id="pt-login"><a href="/index.php?title=Special:UserLogin&returnto=CFEngine+And+OpenWrt" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o">Log in</a></li>
</ul>
</div>
<!-- /0 -->
<div id="left-navigation">
<!-- 0 -->
<div id="p-namespaces" class="vectorTabs">
<h5>Namespaces</h5>
<ul>
<li id="ca-nstab-main" class="selected"><span><a href="/CFEngine_And_OpenWrt.html" title="View the content page [c]" accesskey="c">Page</a></span></li>
<li id="ca-talk" class="new"><span><a href="/index.php?title=Talk:CFEngine_And_OpenWrt&action=edit&redlink=1" title="Discussion about the content page [t]" accesskey="t">Discussion</a></span></li>
</ul>
</div>
<!-- /0 -->
<!-- 1 -->
<div id="p-variants" class="vectorMenu emptyPortlet">
<h4>
</h4>
<h5><span>Variants</span><a href="#"></a></h5>
<div class="menu">
<ul>
</ul>
</div>
</div>
<!-- /1 -->
</div>
<div id="right-navigation">
<!-- 0 -->
<div id="p-views" class="vectorTabs">
<h5>Views</h5>
<ul>
<li id="ca-view" class="selected"><span><a href="/CFEngine_And_OpenWrt.html" >Read</a></span></li>
<li id="ca-viewsource"><span><a href="/index.php?title=CFEngine_And_OpenWrt&action=edit" title="This page is protected. You can view its source [e]" accesskey="e">View source</a></span></li>
<li id="ca-history" class="collapsible"><span><a href="/index.php?title=CFEngine_And_OpenWrt&action=history" title="Past revisions of this page [h]" accesskey="h">View history</a></span></li>
</ul>
</div>
<!-- /0 -->
<!-- 1 -->
<div id="p-cactions" class="vectorMenu emptyPortlet">
<h5><span>Actions</span><a href="#"></a></h5>
<div class="menu">
<ul>
</ul>
</div>
</div>
<!-- /1 -->
<!-- 2 -->
<div id="p-search">
<h5><label for="searchInput">Search</label></h5>
<form action="/index.php" id="searchform">
<div>
<input type="search" name="search" title="Search Kyle's Wiki [f]" accesskey="f" id="searchInput" /> <input type="submit" name="go" value="Go" title="Go to a page with this exact name if exists" id="searchGoButton" class="searchButton" /> <input type="submit" name="fulltext" value="Search" title="Search the pages for this text" id="mw-searchButton" class="searchButton" /> <input type='hidden' name="title" value="Special:Search"/>
</div>
</form>
</div>
<!-- /2 -->
</div>
</div>
<!-- /header -->
<!-- panel -->
<div id="mw-panel" class="noprint">
<!-- logo -->
<div id="p-logo"><a style="background-image: url(http://wiki.xkyle.com/images/logo.jpg);" href="/Main_Page" title="Visit the main page"></a></div>
<!-- /logo -->
<!-- Efforts -->
<div class="portal" id='p-Efforts'>
<h5>Efforts</h5>
<div class="body">
<ul>
<li id="n-Plug-Computers"><a href="/Plug_Computers.html">Plug Computers</a></li>
<li id="n-Hack-This-Site"><a href="/Hack_This_Site.html">Hack This Site</a></li>
<li id="n-Games-Magazine"><a href="/Games_Magazine.html">Games Magazine</a></li>
<li id="n-CFEngine"><a href="/Category:CFEngine.html">CFEngine</a></li>
<li id="n-Puppet"><a href="/Category:Puppet.html">Puppet</a></li>
<li id="n-BackupPC"><a href="/Category:BackupPC.html">BackupPC</a></li>
<li id="n-IPv6"><a href="/Category:IPv6.html">IPv6</a></li>
</ul>
</div>
</div>
<!-- /Efforts -->
<!-- SEARCH -->
<!-- /SEARCH -->
<!-- TOOLBOX -->
<div class="portal" id='p-tb'>
<h5>Toolbox</h5>
<div class="body">
<ul>
<li id="t-whatlinkshere"><a href="/Special:WhatLinksHere/CFEngine_And_OpenWrt" title="A list of all wiki pages that link here [j]" accesskey="j">What links here</a></li>
<li id="t-recentchangeslinked"><a href="/Special:RecentChangesLinked/CFEngine_And_OpenWrt" title="Recent changes in pages linked from this page [k]" accesskey="k">Related changes</a></li>
<li id="t-specialpages"><a href="/Special:SpecialPages.html" title="A list of all special pages [q]" accesskey="q">Special pages</a></li>
<li><a href="/index.php?title=CFEngine_And_OpenWrt&printable=yes" rel="alternate">Printable version</a></li>
<li id="t-permalink"><a href="/index.php?title=CFEngine_And_OpenWrt&oldid=2805" title="Permanent link to this revision of the page">Permanent link</a></li>
</ul>
</div>
</div>
<!-- /TOOLBOX -->
<!-- LANGUAGES -->
<!-- /LANGUAGES -->
<div class="portal" id='p-Meta'>
<h5>Meta</h5>
<div class="body">
<ul>
<li id="n-About-this-Wiki"><a href="/About.html">About this Wiki</a></li>
<li id="n-Email-Me"><a href="mailto:kyle@xkyle.com">Email Me</a></li>
<li id="n-Blog"><a href="https://xkyle.com/">My Blog</a></li>
<li id="n-Code"><a href="https://github.com/solarkennedy">Code (github)</a></li>
<li id="n-LinkedIn"><a href="http://www.linkedin.com/pub/kyle-anderson/6/671/2b0">LinkedIn</a></li>
<li id="n-Google+"><a href="https://plus.google.com/u/0/115227890884261811459" rel="author">Google+</a><li>
</ul>
</div>
</div>
</div>
<!-- /panel -->
<!-- footer -->
<div id="footer">
<div style="clear:both"></div>
</div>
<!-- /footer -->
<script src="http://wiki.xkyle.com/load.php?debug=false&lang=en&modules=skins.vector&only=scripts&skin=vector&*"></script>
<script>if(window.mw){
mw.loader.load(["mediawiki.user","mediawiki.page.ready"], null, true);
}</script>
<!-- Served in 0.226 secs. -->
</body>
<!-- Cached/compressed 20130921040139 -->
</html>