Configuring Ansible to run on localhost

Since ansible-pull relies on Git to clone the repository and execute it locally, we don't need the execution to happen over SSH. Go to the root directory of your Ansible repository to create a new file.

The file should be called localhost and contain the following:

[localhost] 
localhost ansible_connection=local 

Essentially, what we are doing is creating a static inventory and asking ansible to run commands in local (as opposed to using SSH) when the target host is localhost.

We can save the changes and commit the new file to GitHub:

$ git add localhost
$ git commit -m "Adding localhost inventory"
$ git push  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset