How to assign multiple IPs to a single host using ansible nios module

1.3k Views Asked by At

I need to assign multiple IPs to the same host using Ansible nios modules. I tried using nios_host_record module but it doesn't work in this scenario.

- name: configure an ipv4 host record
  nios_host_record:
    name: host.ansible.com
    ipv4:
      - address: 192.168.10.1
    aliases:
      - cname.ansible.com
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local"
1

There are 1 best solutions below

0
Naveen Chandra Sekhara On

You can add multiple IPs like a list. Wish Ansible documentation for modules should have more examples like this.

ipv4:
 - address: 192.168.10.1
 - address: 192.168.10.2
 - address: 192.168.10.3