# Add Additional Ip Addresses to an interface.

**URL:** <https://forum.ansible.com/t/add-additional-ip-addresses-to-an-interface/33283>\
**Category:** Ansible Project\
**Created:** [June 30, 2020, 10:57am UTC](https://forum.ansible.com/t/add-additional-ip-addresses-to-an-interface/33283 "2020-06-30T10:57:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Robinson](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@Paul\_Robinson](https://forum.ansible.com/u/Paul_Robinson)\
**Post date:** [June 30, 2020, 10:57am UTC](https://forum.ansible.com/t/add-additional-ip-addresses-to-an-interface/33283/1 "2020-06-30T10:57:43Z")

</div>

Firstly just to say I’m new to ansible and learning as I go along.

I have configure a playbook that clones 3 virtual machines using the following inventory file which has a few custom variables added for my needs

ansible-playbook -i vms-to-deploy deploy\_sap\_vm.yml

vms-to-deploy

[netweaver]

prcsapnwd01 deploy\_vsphere\_datastore=‘datastore2’ guest\_custom\_ip=‘10.0.14.20’ sap\_sid=‘NWD’ virtual\_alias\_ip=‘10.0.14.21,10.0.14.22,10.0.14.23’  
prcsapnwq01 deploy\_vsphere\_datastore=‘datastore2’ guest\_custom\_ip=‘10.0.14.30’ sap\_sid=‘NWQ’ virtual\_alias\_ip=‘10.0.14.31,10.0.14.32,10.0.14.33’  
prcsapnwp01 deploy\_vsphere\_datastore=‘datastore2’ guest\_custom\_ip=‘10.0.14.40’ sap\_sid=‘NWP’ virtual\_alias\_ip=‘10.0.14.41,10.0.14.32,10.0.14.43’

I have successfully managed to clone the vm’s using vmware\_guest role which then customizes the virtual machines and assigns the guest\_custom\_ip to be the ip of the physical interface eth0

The next task I want to perform is to add additional ip addresses to that adapter eth0 so for example in the case of host prcsapnwd01 eth0 has

eth0:  
10.0.14.20 (Phsyical Host)  
10.0.14.21 (Virtual Alias IP)

10.0.14.22 (Virtual Alias IP)

10.0.14.23 (Virtual Alias IP)

The linux-system-roles.network looks like it can do the job for me.

I am just not sure how i go about reading the additional ip addresses from my inventory file and passing them to the task variables.

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![Paul\_Robinson](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@Paul\_Robinson](https://forum.ansible.com/u/Paul_Robinson)\
**Post date:** [July 2, 2020, 11:10am UTC](https://forum.ansible.com/t/add-additional-ip-addresses-to-an-interface/33283/2 "2020-07-02T11:10:48Z")

</div>

Managed to resolve this myself with the following playbook

cat network-ip-config.yml
