need assistance to gather access list rules associated with public ip's only using ansible

You have to use regex patterns to match the desired ACL’s

Globally acceptable internal IP pool will be 172*, 10* and 192*. So all other ips will be public.
Now list all the ips in all acl, append it to a template file, filter it based on desired port, use regular expression (^)as said below and get it concatenated to same file.