github.com/tonnydourado/packer@v0.6.1-0.20140701134019-5d0cd9676a37/website/source/docs/provisioners/ansible-local.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Ansible (Local) Provisioner" 4 --- 5 6 # Ansible Local Provisioner 7 8 Type: `ansible-local` 9 10 The `ansible-local` provisioner configures Ansible to run on the machine by 11 Packer from local Playbook and Role files. Playbooks and Roles can be uploaded 12 from your local machine to the remote machine. Ansible is run in [local mode](http://docs.ansible.com/playbooks_delegation.html#local-playbooks) via the `ansible-playbook` command. 13 14 ## Basic Example 15 16 The example below is fully functional. 17 18 <pre class="prettyprint"> 19 { 20 "type": "ansible-local", 21 "playbook_file": "local.yml" 22 } 23 </pre> 24 25 ## Configuration Reference 26 27 The reference of available configuration options is listed below. 28 29 Required: 30 31 * `playbook_file` (string) - The playbook file to be executed by ansible. 32 This file must exist on your local system and will be uploaded to the 33 remote machine. 34 35 Optional: 36 37 * `command` (string) - The command to invoke ansible. Defaults to "ansible-playbook". 38 39 * `extra_arguments` (array of strings) - An array of extra arguments to pass to the 40 ansible command. By default, this is empty. 41 42 * `inventory_file` (string) - The inventory file to be used by ansible. 43 This file must exist on your local system and will be uploaded to the 44 remote machine. 45 46 When using an inventory file, it's also required to `--limit` the hosts to 47 the specified host you're buiding. The `--limit` argument can be provided in 48 the `extra_arguments` option. 49 50 An example inventory file may look like: 51 <pre class="prettyprint"> 52 [chi-dbservers] 53 db-01 ansible_connection=local 54 db-02 ansible_connection=local 55 56 [chi-appservers] 57 app-01 ansible_connection=local 58 app-02 ansible_connection=local 59 60 [chi:children] 61 chi-dbservers 62 chi-appservers 63 64 [dbservers:children] 65 chi-dbservers 66 67 [appservers:children] 68 chi-appservers 69 </pre> 70 71 * `playbook_dir` (string) - a path to the complete ansible directory 72 structure on your local system to be copied to the remote machine 73 as the `staging_directory` before all other files and directories. 74 75 * `playbook_paths` (array of strings) - An array of paths to playbook files on 76 your local system. These will be uploaded to the remote machine under 77 `staging_directory`/playbooks. By default, this is empty. 78 79 * `role_paths` (array of strings) - An array of paths to role directories on 80 your local system. These will be uploaded to the remote machine under 81 `staging_directory`/roles. By default, this is empty. 82 83 * `staging_directory` (string) - The directory where all the configuration of 84 Ansible by Packer will be placed. By default this is "/tmp/packer-provisioner-ansible-local". 85 This directory doesn't need to exist but must have proper permissions so that 86 the SSH user that Packer uses is able to create directories and write into 87 this folder. If the permissions are not correct, use a shell provisioner prior 88 to this to configure it properly.