-
Notifications
You must be signed in to change notification settings - Fork 162
Added so you can search after IP in address object instead of name #420
Conversation
Is there a timeline until this gets put into dev? |
This is my code and output. Can you help me identify what's wrong?
** The spaces are a little off from pasting it. **fatal: [localhost]: FAILED! => { |
Which branch did you test with ? To get it to work you need to use my branch until they have accept my merge request. |
I'm sorry, maybe I'm missing it, but I don't see in your branch the search ip address. I see the search object though. Thanks. |
I'm using your branch, I cloned it from your link you provided. I believe I am also running into the issue GrayBeard80 is. I copied your example and modified it for my environment but it doesn't seem to like the value: '192.168.0.0/24' portion. So I'm unable to search for an object by IP address. This is the error I get, and in the error output I don't see 'value' specified there under supported parameters, not sure if that's relevant or not. fatal: [PA1]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (panos_object_facts) module: value Supported pae_group, ip_address, name, name_regex, object_type, password, port, provider, username, vsys"} snippet of my task:
Am I using it wrong? |
I tried my branch in it's own new virtual-env and no problem .
|
Can you expand on step 2? you moved the ansible-pan folder into roles folder of your branch? |
I have that same question too as well as what your 'panos_provider' variable is. |
sorry, nevermind, I figured out 'provider' |
Well I got it to work. I tried to just use the regex task to see if that would work, and it successfully pulled all the objects. I then changed "value_regex" to just value and put in an IP "value: '192.168.1.2' and it returned the object with that IP. I will say though there seems to be some issues with the IP scheme, palo alto lets you enter in either just an IP or an IP and netmask, for instance either "192.168.1.2" or "192.168.1.2/32" and both are valid addressing schemes. What I have found with this build is that if I have an object with the IP of "192.168.1.2/32" and in the playbook I use value: '192.168.1.2' it returns empty results. If I were to use value: '192.168.1.2/32' it works as it should. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panos_object_facts
reports on facts for more than just address objects, and AddressObject
is the name of a class, so naming the variable that is misleading. Also, I don't think storing an object's .about()
into a variable so you can do foo["value"]
nets you anything since you can just do foo.value
and have the same result.
If we're trying to add functionality to this module that would extend beyond just address objects, I think it would be better to add a more flexible set of params to this module:
- one param that accepts the name of the parameter to search (default:
value
) - one param that accepts the type of search to perform. This could accept, say,
exact
/regex
, then a new search ofcidr regex
or something could be added later that would implement better CIDR searching that the comments in this PR are eliciting.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll go ahead and make the tweaks that I've suggested in my comments after I merge this PR; thanks for the work on this!
Like the title saids. To search after IP instead of name in Addresses. Instead of using name/name_regex you use value/value_regex. It will also solve issue number #66
Exemple :
output :
Or with value_regex :
Output :