Lookup ceph public ip addr

Add the ability to set up the ip address
of monmap accordingly to the ceph public
network.

Sem-Ver: feature
Change-Id: Ieac0960804d601d0b0da36f62ae59d74aed9765f
diff --git a/molecule/default/requirements.txt b/molecule/default/requirements.txt
index 7f9f540..57cadeb 100644
--- a/molecule/default/requirements.txt
+++ b/molecule/default/requirements.txt
@@ -1,2 +1,3 @@
 molecule==3.5.2 # https://github.com/ansible-community/molecule/issues/3435
-openstacksdk
\ No newline at end of file
+openstacksdk
+netaddr
\ No newline at end of file
diff --git a/releasenotes/notes/lookup-ceph-public-iface-e9147f1615e8371b.yaml b/releasenotes/notes/lookup-ceph-public-iface-e9147f1615e8371b.yaml
new file mode 100644
index 0000000..636f265
--- /dev/null
+++ b/releasenotes/notes/lookup-ceph-public-iface-e9147f1615e8371b.yaml
@@ -0,0 +1,6 @@
+---
+features:
+  - |
+    Add the ability to lookup for the ip address of the
+    ceph public network. This is useful when the ceph public
+    network is differnet from the default network on the system.
\ No newline at end of file
diff --git a/roles/ceph_mon/tasks/main.yml b/roles/ceph_mon/tasks/main.yml
index c6d64b5..90cdfc2 100644
--- a/roles/ceph_mon/tasks/main.yml
+++ b/roles/ceph_mon/tasks/main.yml
@@ -19,7 +19,7 @@
 
 - name: set ceph monitor ip address
   ansible.builtin.set_fact:
-    ceph_mon_ip_address: "{{ ansible_default_ipv4.address }}"
+    ceph_mon_ip_address: "{{ ansible_all_ipv4_addresses | ansible.netcommon.ipaddr(ceph_mon_public_network) | first }}"
 
 - name: generate basic configuration file
   community.general.ini_file: