mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Update facter/ohai parts to talk about ansible facts in most recent release
This commit is contained in:
parent
eba1340542
commit
d6368ab4fa
5 changed files with 28 additions and 23 deletions
|
@ -223,15 +223,18 @@ ansible webservers -m template -a "src=/srv/motd.j2 dest=/etc/motd"
|
|||
ansible webservers -m template -a "src=/srv/ntp.j2 dest=/etc/ntp.conf"</pre>
|
||||
</div>
|
||||
<p>Ansible variables are used in templates by using the name surrounded by double
|
||||
curly-braces. If facter or ohai were installed on the remote machine, variables
|
||||
curly-braces. Ansible provides some ‘facts’ about the system being managed
|
||||
automatically in playbooks or when the setup module is run manually. If facter or ohai
|
||||
were installed on the remote machine, variables
|
||||
from those programs can be accessed too, using the appropriate prefix:</p>
|
||||
<div class="highlight-python"><pre>This is an Ansible variable: {{ favcolor }}
|
||||
This is a facter variable: {{ facter_hostname }}
|
||||
This is an ohai variable: {{ ohai_foo }}</pre>
|
||||
This is an Ansible fact: {{ ansible_hostname }}
|
||||
This is a facter fact: {{ facter_hostname }}
|
||||
This is an ohai fact: {{ ohai_foo }}</pre>
|
||||
</div>
|
||||
<p>NOTE: Ansible 0.3 (releasing very soon) will also supply built-in facts, so you won’t
|
||||
need to install ruby on any of your remote machines if you don’t want to. These
|
||||
are prefixed with <cite>ansible_</cite>.</p>
|
||||
<p>Using the Ansible facts is generally preferred as that way you can avoid a dependency
|
||||
on ruby. If you want to use facter instead, you will also need rubygem-json because
|
||||
the facter packages may forget this as a dependency.</p>
|
||||
<p>The <cite>file</cite> module allows changing ownership and permissions on files. These
|
||||
same options can be passed directly to the <cite>copy</cite> or <cite>template</cite> modules as well:</p>
|
||||
<div class="highlight-python"><pre>ansible webservers -m file -a "dest=/srv/foo/a.txt mode=600"
|
||||
|
|
9
faq.html
9
faq.html
|
@ -240,8 +240,8 @@ other systems that depend on that system.</p>
|
|||
does not create its own programming language. What constructs Ansible does have should be enough to cover 80% or so of the cases of most Puppet users, and it should scale equally well (not having a server is
|
||||
almost like cheating).</p>
|
||||
<p>Ansible does support gathering variables from ‘facter’, if installed, and Ansible templates
|
||||
in jinja2 in a way just like Puppet does with erb. Ansible in version 0.3 will has it’s own facts,
|
||||
however, so it will not need to rely on facter, but can use it if available.</p>
|
||||
in jinja2 in a way just like Puppet does with erb. Ansible also has it’s own facts though,
|
||||
so usage of facter is not required to get variables about the system.</p>
|
||||
</div>
|
||||
<div class="section" id="vs-chef">
|
||||
<h3>vs Chef?<a class="headerlink" href="#vs-chef" title="Permalink to this headline">¶</a></h3>
|
||||
|
@ -261,9 +261,8 @@ Chef and Puppet are around 60k+ lines of code, while Ansible is a much simpler
|
|||
program. I believe this strongly leads to more reliable software and a richer
|
||||
open source community – the code is kept simple so it is easy for anyone to
|
||||
submit a patch or module.</p>
|
||||
<p>Ansible does support gathering variables from ‘ohai’, if installed. As of release
|
||||
0.3, Ansible will also have it’s own facts system so you will not need to use ohai
|
||||
or facter (or have a dependency on Ruby).</p>
|
||||
<p>Ansible does support gathering variables from ‘ohai’, if installed. Ansible also
|
||||
has it’s own facts so you do not need to use ohai unless you want to.</p>
|
||||
</div>
|
||||
<div class="section" id="vs-capistrano-fabric">
|
||||
<h3>vs Capistrano/Fabric?<a class="headerlink" href="#vs-capistrano-fabric" title="Permalink to this headline">¶</a></h3>
|
||||
|
|
|
@ -79,16 +79,19 @@ simpler::
|
|||
ansible webservers -m template -a "src=/srv/ntp.j2 dest=/etc/ntp.conf"
|
||||
|
||||
Ansible variables are used in templates by using the name surrounded by double
|
||||
curly-braces. If facter or ohai were installed on the remote machine, variables
|
||||
curly-braces. Ansible provides some 'facts' about the system being managed
|
||||
automatically in playbooks or when the setup module is run manually. If facter or ohai
|
||||
were installed on the remote machine, variables
|
||||
from those programs can be accessed too, using the appropriate prefix::
|
||||
|
||||
This is an Ansible variable: {{ favcolor }}
|
||||
This is a facter variable: {{ facter_hostname }}
|
||||
This is an ohai variable: {{ ohai_foo }}
|
||||
This is an Ansible fact: {{ ansible_hostname }}
|
||||
This is a facter fact: {{ facter_hostname }}
|
||||
This is an ohai fact: {{ ohai_foo }}
|
||||
|
||||
NOTE: Ansible 0.3 (releasing very soon) will also supply built-in facts, so you won't
|
||||
need to install ruby on any of your remote machines if you don't want to. These
|
||||
are prefixed with `ansible_`.
|
||||
Using the Ansible facts is generally preferred as that way you can avoid a dependency
|
||||
on ruby. If you want to use facter instead, you will also need rubygem-json because
|
||||
the facter packages may forget this as a dependency.
|
||||
|
||||
The `file` module allows changing ownership and permissions on files. These
|
||||
same options can be passed directly to the `copy` or `template` modules as well::
|
||||
|
|
10
rst/faq.rst
10
rst/faq.rst
|
@ -87,8 +87,9 @@ does not create its own programming language. What constructs Ansible does hav
|
|||
almost like cheating).
|
||||
|
||||
Ansible does support gathering variables from 'facter', if installed, and Ansible templates
|
||||
in jinja2 in a way just like Puppet does with erb. Ansible in version 0.3 will has it's own facts,
|
||||
however, so it will not need to rely on facter, but can use it if available.
|
||||
in jinja2 in a way just like Puppet does with erb. Ansible also has it's own facts though,
|
||||
so usage of facter is not required to get variables about the system.
|
||||
|
||||
|
||||
vs Chef?
|
||||
++++++++
|
||||
|
@ -113,9 +114,8 @@ program. I believe this strongly leads to more reliable software and a richer
|
|||
open source community -- the code is kept simple so it is easy for anyone to
|
||||
submit a patch or module.
|
||||
|
||||
Ansible does support gathering variables from 'ohai', if installed. As of release
|
||||
0.3, Ansible will also have it's own facts system so you will not need to use ohai
|
||||
or facter (or have a dependency on Ruby).
|
||||
Ansible does support gathering variables from 'ohai', if installed. Ansible also
|
||||
has it's own facts so you do not need to use ohai unless you want to.
|
||||
|
||||
vs Capistrano/Fabric?
|
||||
+++++++++++++++++++++
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue