O'Reilly logo

JUNOS Automation Cookbook by Adam Chappell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

There's more

The Ansible inventory file is flexible and can deal with per-host parameter association. For example, we don't have to rely on IP addressing to nominate hosts, and we can also deal with situations where Ansible needs to access the devices using different usernames. If we modify our hosts file in order to add an extra OpenBSD device from our LAN with different credentials, we can update the inventory file to look like this.

localhost ansible_host=127.0.0.1 ansible_user=ubuntuopenbsd ansible_host=10.0.201.220 ansible_user=user

Now, when we run our Ansible ping test, we can see both boxes respond and report as available.

ubuntu@ubuntu-xenial:~/ansible$ ansible -i hosts -m ping alllocalhost | SUCCESS => {    "changed": false,  "ping": ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required