updating a portion of the rule - ansible

Reply
Highlighted
L0 Member

updating a portion of the rule - ansible

Wondering if anyone has had any experience updating rules. I have approximately 700 or so rules that i need to add a security profile group to... 

testing the following seems to basically overwrite anything not provided to 'any' 

 

- name: update rules to FW
panos_security_rule:
ip_address: '{{ item.firewall }}'
username: '{{ username }}'
password: '{{ password }}'
rule_name: '{{ item.rule_name }}'
group_profile: '{{ item.profile_group_name }}'
commit: 'False'
with_items: "{{ firewall_rules }}"

 


Accepted Solutions
Highlighted
L4 Transporter

Re: updating a portion of the rule - ansible

Yes!  You can use facts and jinja2 templating functions to accomplish this.  I've authored a blog post that explains everything step by step:

 

https://live.paloaltonetworks.com/t5/Automation-API-Blog/Ansible-Using-Facts-Modules-to-do-Updates/b...

View solution in original post


All Replies
Highlighted
L4 Transporter

Re: updating a portion of the rule - ansible

Yes!  You can use facts and jinja2 templating functions to accomplish this.  I've authored a blog post that explains everything step by step:

 

https://live.paloaltonetworks.com/t5/Automation-API-Blog/Ansible-Using-Facts-Modules-to-do-Updates/b...

View solution in original post

Highlighted
L0 Member

Re: updating a portion of the rule - ansible

giggidy .. thanks!

 

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!