mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-14 13:32:10 +00:00
ipahost: Add support for several IP addresses and also to change them
ipahost was so far ignoring IP addresses when the host already existed.
This happened because host_mod is not providing functionality to do this.
Now ipaddress is a list and it is possible to ensure a host with several
IP addresses (these can be IPv4 and IPv6). Also it is possible to ensure
presence and absence of IP addresses for an exising host using action
member.
There are no IP address conclict checks as this would lead into issues with
updating an existing host that already is using a duplicate IP address for
example for round-robin (RR). Also this might lead into issues with ensuring
a new host with several IP addresses in this case. Also to ensure a list of
hosts with changing the IP address of one host to another in the list would
result in issues here.
New example playbooks have been added:
playbooks/host/host-present-with-several-ip-addresses.yml
playbooks/host/host-member-ipaddresses-absent.yml
playbooks/host/host-member-ipaddresses-present.yml
A new test has been added for verification:
tests/host/test_host_ipaddresses.yml
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1783976
https://bugzilla.redhat.com/show_bug.cgi?id=1783979
This commit is contained in:
17
playbooks/host/host-member-ipaddresses-absent.yml
Normal file
17
playbooks/host/host-member-ipaddresses-absent.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
- name: Host member IP addresses absent
|
||||
hosts: ipaserver
|
||||
become: true
|
||||
|
||||
tasks:
|
||||
- name: Ensure host01.example.com IP addresses absent
|
||||
ipahost:
|
||||
ipaadmin_password: MyPassword123
|
||||
name: host01.example.com
|
||||
ip_address:
|
||||
- 192.168.0.123
|
||||
- fe80::20c:29ff:fe02:a1b3
|
||||
- 192.168.0.124
|
||||
- fe80::20c:29ff:fe02:a1b4
|
||||
action: member
|
||||
state: absent
|
||||
16
playbooks/host/host-member-ipaddresses-present.yml
Normal file
16
playbooks/host/host-member-ipaddresses-present.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
- name: Host member IP addresses present
|
||||
hosts: ipaserver
|
||||
become: true
|
||||
|
||||
tasks:
|
||||
- name: Ensure host01.example.com IP addresses present
|
||||
ipahost:
|
||||
ipaadmin_password: MyPassword123
|
||||
name: host01.example.com
|
||||
ip_address:
|
||||
- 192.168.0.123
|
||||
- fe80::20c:29ff:fe02:a1b3
|
||||
- 192.168.0.124
|
||||
- fe80::20c:29ff:fe02:a1b4
|
||||
action: member
|
||||
24
playbooks/host/host-present-with-several-ip-addresses.yml
Normal file
24
playbooks/host/host-present-with-several-ip-addresses.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
- name: Host present with several IP addresses
|
||||
hosts: ipaserver
|
||||
become: true
|
||||
|
||||
tasks:
|
||||
- name: Ensure host is present
|
||||
ipahost:
|
||||
ipaadmin_password: MyPassword123
|
||||
name: host01.example.com
|
||||
description: Example host
|
||||
ip_address:
|
||||
- 192.168.0.123
|
||||
- fe80::20c:29ff:fe02:a1b3
|
||||
- 192.168.0.124
|
||||
- fe80::20c:29ff:fe02:a1b4
|
||||
locality: Lab
|
||||
ns_host_location: Lab
|
||||
ns_os_version: CentOS 7
|
||||
ns_hardware_platform: Lenovo T61
|
||||
mac_address:
|
||||
- "08:00:27:E3:B1:2D"
|
||||
- "52:54:00:BD:97:1E"
|
||||
state: present
|
||||
Reference in New Issue
Block a user