From the course: Ansible Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Working with IP addresses in Ansible

Working with IP addresses in Ansible - Ansible Tutorial

From the course: Ansible Essential Training

Working with IP addresses in Ansible

- [Instructor] When we are using Ansible to perform automation in the network, one of the things that we need Ansible to really help us with is IP addresses. Yeah, these are very particular addresses. We love them in dotted decimal prefix notation, and we need Ansible to be able to deal with these IP addresses. Well, let's see how we can do this. I've created a playbook for us called ip_address.yml. And when we look inside this simple playbook, first of all, you can see that we're running this against the local hosts with a local connection. Where we're running it really isn't important. What's important is how we can manipulate IP address and mask information. So notice I create a variable that is our default gateway in dotted decimal notation, 10.10.0.1, and then the network mask in the dotted decimal notation. So now we are going to manipulate these variables to give us some exciting information. The first thing I would…

Contents