From 47971b2e85d521cc6ab04451aa34c2c27194022e Mon Sep 17 00:00:00 2001 From: Danny Berger Date: Tue, 19 Feb 2013 17:00:35 -0700 Subject: [PATCH] facter in ant --- .../2013-02-19-using-facter-in-ant-scripts.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 blog/_posts/2013-02-19-using-facter-in-ant-scripts.md diff --git a/blog/_posts/2013-02-19-using-facter-in-ant-scripts.md b/blog/_posts/2013-02-19-using-facter-in-ant-scripts.md new file mode 100644 index 0000000..379940b --- /dev/null +++ b/blog/_posts/2013-02-19-using-facter-in-ant-scripts.md @@ -0,0 +1,62 @@ +--- +title: Using Facter in Ant Scripts +layout: post +tags: ant facter +description: Reusing facts from build scripts. +--- + +After using [puppet][1] for a while I have become use to some of the facts that [facter][2] automatically provides. When +working with [ant][3] build scripts, I started wishing I didn't have to generate similar facts myself through various +`exec` calls. + +### One Fact + +Instead of fragile lookups like... + +{% highlight xml %} + + + + +{% endhighlight %} + +I can simplify it with... + +{% highlight xml %} + + + +{% endhighlight %} + + +### In Bulk + +Or I can load all facts with... + +{% highlight xml %} + + + + + + +{% endhighlight %} + +And reference a fact in my task... + +{% highlight xml %} + + + + +{% endhighlight %} + +### Summary + +So now it's much easier to reference environment information from property files (via interpolation), make targets more +conditional, and, of course, from actual tasks. + + + [1]: https://puppetlabs.com/puppet/what-is-puppet/ + [2]: https://puppetlabs.com/puppet/related-projects/facter/ + [3]: http://ant.apache.org/