diff --git a/YAMLSyntax.html b/YAMLSyntax.html index 168be0eefb..f027301ddd 100644 --- a/YAMLSyntax.html +++ b/YAMLSyntax.html @@ -140,7 +140,6 @@ s.parentNode.insertBefore(ga, s);
  • API & Integrations
  • Module Development
  • FAQ
  • -
  • Glossary
  • Who Uses Ansible
  • @@ -290,7 +289,7 @@ languages:

    © Copyright 2012 Michael DeHaan.
    - Last updated on Aug 10, 2012.
    + Last updated on Aug 14, 2012.

    diff --git a/api.html b/api.html index 803bf45e3a..5b77aee63f 100644 --- a/api.html +++ b/api.html @@ -140,7 +140,6 @@ s.parentNode.insertBefore(ga, s);
  • API & Integrations
  • Module Development
  • FAQ
  • -
  • Glossary
  • Who Uses Ansible
  • @@ -470,7 +469,7 @@ e.g.

    © Copyright 2012 Michael DeHaan.
    - Last updated on Aug 10, 2012.
    + Last updated on Aug 14, 2012.

    diff --git a/bestpractices.html b/bestpractices.html index e34a24201e..222e267b8a 100644 --- a/bestpractices.html +++ b/bestpractices.html @@ -140,7 +140,6 @@ s.parentNode.insertBefore(ga, s);
  • API & Integrations
  • Module Development
  • FAQ
  • -
  • Glossary
  • Who Uses Ansible
  • @@ -341,7 +340,7 @@ different variables to different geographies.

    © Copyright 2012 Michael DeHaan.
    - Last updated on Aug 10, 2012.
    + Last updated on Aug 14, 2012.

    diff --git a/examples.html b/examples.html index b7cc266e9a..7460e34789 100644 --- a/examples.html +++ b/examples.html @@ -140,7 +140,6 @@ s.parentNode.insertBefore(ga, s);
  • API & Integrations
  • Module Development
  • FAQ
  • -
  • Glossary
  • Who Uses Ansible
  • @@ -157,6 +156,7 @@ s.parentNode.insertBefore(ga, s);
  • Deploying From Source Control
  • Managing Services
  • Time Limited Background Operations
  • +
  • Limiting Selected Hosts
  • @@ -261,32 +261,8 @@ optionally use them as template sources.

    $ ansible atlanta -m copy -a "src=/etc/hosts dest=/tmp/hosts"
     
    -

    To use templating, first run the setup module to put the template -variables you would like to use on the remote host. Then use the -template module to write the files using those templates.

    -

    Templates are written in Jinja2 -format. Playbooks will run the setup module for you, making -this even simpler:

    -
    $ ansible webservers -m setup    -a "favcolor=red ntp_server=192.168.1.1"
    -$ 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"
    -
    -
    -

    Ansible variables are used in templates by using the name surrounded -by double 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 an Ansible fact: {{ ansible_hostname }}
    -This is a facter fact: {{ facter_hostname }}
    -This is an ohai fact: {{ ohai_foo }}
    -
    -
    -

    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.

    +

    If you use playbooks, you can also take advantage of the template module, +which takes this another step further.

    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:

    $ ansible webservers -m file -a "dest=/srv/foo/a.txt mode=600"
    @@ -393,6 +369,28 @@ the remote nodes will be terminated.

    backgrounded. Typically you’ll be backgrounding long-running shell commands or software upgrades only. Playbooks also support polling, and have a simplified syntax for this.

    +
    +
    +

    Limiting Selected Hosts

    +

    +New in version 0.7.

    +

    What hosts you select to manage can be additionally constrained by using the ‘–limit’ parameter or +by using ‘batch’ (or ‘range’) selectors.

    +

    As mentioned above, patterns can be strung together to select hosts in more than one group:

    +
    $ ansible webservers:dbservers -m command -a "/bin/foo xyz"
    +
    +
    +

    This is an “or” condition. If you want to further constrain the selection, use –limit, which +also works with ansible-playbook:

    +
    $ ansible webservers:dbservers -m command -a "/bin/foo xyz" region
    +
    +
    +

    Now let’s talk about range selection. Suppose you have 1000 servers in group ‘datacenter’, but only want to target one at a time. This is also easy:

    +
    $ ansible webservers[0-100] -m command -a "/bin/foo xyz"
    +$ ansible webservers[101-200] -m command -a "/bin/foo xyz"
    +
    +
    +

    Both of these methods can be used at the same time, and ranges can also be passed to the –limit parameter.

    See also

    @@ -437,7 +435,7 @@ a simplified syntax for this.

    © Copyright 2012 Michael DeHaan.
    - Last updated on Aug 10, 2012.
    + Last updated on Aug 14, 2012.

    diff --git a/faq.html b/faq.html index dab8c5585a..7602170e09 100644 --- a/faq.html +++ b/faq.html @@ -27,7 +27,7 @@ - + - +