Ansible Docs: Fix headers and indentation
Align the headers style and wording in the intro page. [ci skip]
This commit is contained in:
parent
e436f53fe9
commit
c3f0b1c1b2
|
@ -89,7 +89,7 @@ When using Ansible, it needs to know on which machines a given playbook should r
|
|||
|
||||
The first and simplest option is to not provide one to Vagrant at all. Vagrant will generate an inventory file encompassing all of the virtual machines it manages, and use it for provisioning machines.
|
||||
|
||||
**Example with the [`ansible`](/docs/provisioning/ansible.html) provisioner:**
|
||||
#### Example with the [`ansible`](/docs/provisioning/ansible.html) provisioner
|
||||
|
||||
```
|
||||
# Generated by Vagrant
|
||||
|
@ -100,7 +100,7 @@ default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2200 ansible_ssh_user='vagra
|
|||
Note that the generated inventory file is stored as part of your local Vagrant environment in
|
||||
`.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory`.
|
||||
|
||||
**Example with the [`ansible_local`](/docs/provisioning/ansible_local.html) provisioner:**
|
||||
#### Example with the [`ansible_local`](/docs/provisioning/ansible_local.html) provisioner
|
||||
|
||||
```
|
||||
# Generated by Vagrant
|
||||
|
@ -110,10 +110,12 @@ default ansible_connection=local
|
|||
|
||||
Note that the generated inventory file is uploaded to the guest VM in a subdirectory of [`tmp_path`](/docs/provisioning/ansible_local.html), e.g. `/tmp/vagrant-ansible/inventory/vagrant_ansible_local_inventory`.
|
||||
|
||||
**Host variables:**
|
||||
#### Host Variables
|
||||
|
||||
As of Vagrant 1.8.0, the [`host_vars`](/docs/provisioning/ansible_common.html#host_vars) option can be used to set [variables for individual hosts](https://docs.ansible.com/ansible/intro_inventory.html#host-variables) in the generated inventory file (see also the notes on group variables below).
|
||||
|
||||
With this configuration example:
|
||||
|
||||
```
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.define "host1"
|
||||
|
@ -130,7 +132,7 @@ Vagrant.configure("2") do |config|
|
|||
end
|
||||
```
|
||||
|
||||
Generated inventory:
|
||||
Vagrant would generate the following inventory file:
|
||||
|
||||
```
|
||||
# Generated by Vagrant
|
||||
|
@ -139,7 +141,7 @@ host1 ansible_ssh_host=... http_port=80 maxRequestsPerChild=808
|
|||
host2 ansible_ssh_host=... http_port=303 maxRequestsPerChild=909
|
||||
```
|
||||
|
||||
**How to generate Inventory Groups:**
|
||||
#### Groups and Group Variables
|
||||
|
||||
The [`groups`](/docs/provisioning/ansible_common.html#groups) option can be used to pass a hash of group names and group members to be included in the generated inventory file.
|
||||
|
||||
|
@ -170,7 +172,7 @@ Vagrant.configure("2") do |config|
|
|||
end
|
||||
```
|
||||
|
||||
Vagrant would generate an inventory file that might look like:
|
||||
Vagrant would generate the following inventory file:
|
||||
|
||||
```
|
||||
# Generated by Vagrant
|
||||
|
@ -205,15 +207,15 @@ variable2=example
|
|||
- The generation of group variables blocks (e.g. `[group1:vars]`) is only possible since Vagrant 1.8.0. Note however that setting variables directly in the inventory is not the [preferred practice in Ansible](https://docs.ansible.com/intro_inventory.html#splitting-out-host-and-group-specific-data). If possible, group (or host) variables should be set in `YAML` files stored in the `group_vars/` or `host_vars/` directories in the playbook (or inventory) directory instead.
|
||||
- Unmanaged machines and undefined groups are not added to the inventory, to avoid useless Ansible errors (e.g. *unreachable host* or *undefined child group*)
|
||||
|
||||
For example, `machine3` and `group3` in the example below would not be added to the generated inventory file:
|
||||
For example, `machine3` and `group3` in the example below would not be added to the generated inventory file:
|
||||
|
||||
```ruby
|
||||
ansible.groups = {
|
||||
"group1" => ["machine1"],
|
||||
"group2" => ["machine2", "machine3"],
|
||||
"all_groups:children" => ["group1", "group2", "group3"]
|
||||
}
|
||||
```
|
||||
```ruby
|
||||
ansible.groups = {
|
||||
"group1" => ["machine1"],
|
||||
"group2" => ["machine2", "machine3"],
|
||||
"all_groups:children" => ["group1", "group2", "group3"]
|
||||
}
|
||||
```
|
||||
- [Host range patterns (numeric and alphabetic ranges)](https://docs.ansible.com/ansible/intro_inventory.html#hosts-and-groups) will not be validated by Vagrant. As of Vagrant 1.8.0, host range patterns will be added as group members to the inventory anyway, this might lead to errors in Ansible (e.g *unreachable host*).
|
||||
|
||||
### Static Inventory
|
||||
|
|
Loading…
Reference in New Issue