Hi,
I’ve been stuck on this issue for a few days and I’m still unable to make it work, even though it should be doable. Essentially, I’m doing a shell command which gives me the following return (please don’t suggest to use an ansible module for this, the ansible module and shade don’t support choosing the subnet when associating a floatingip)
-
“stdout_lines”: [
-
“Created a new floatingip:”,
-
“±--------------------±-------------------------------------+”,
-
“| Field | Value |”,
-
“±--------------------±-------------------------------------+”,
-
“| created_at | 2018-02-19T09:32:44Z |”,
-
“| description | |”,
-
“| fixed_ip_address | 10.80.16.60 |”,
-
“| floating_ip_address | 192.168.0.1 |”,
-
“| floating_network_id | uuid |”,
-
“| id | uuid |”,
-
“| port_id | uuid |”,
-
“| project_id | uuid |”,
-
“| revision_number | 1 |”,
-
“| router_id | uuid |”,
-
“| status | DOWN |”,
-
“| tenant_id | uuid |”,
-
“| updated_at | 2018-02-19T09:32:44Z |”,
-
"±--------------------±-------------------------------------+
Essentially, I want to extract the floating_ip_address line. So, I’ve been using a commonly recognized regex for IP address and, right now, I’ve reached the point where I have the following line:
-
- name: extract the ip line
-
set_fact:
-
regexcomp: “{{ rawfloating.stdout_lines | regex_search(‘floating_ip_address \| \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b’) }}”
Now ansible tells me that it’s expecting a string or buffer. I’m not sure what to do anymore. Anyone has any ideas?