Issues to create my First Playbook on a VM-500 Virtual Palo Alto Firewall

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Issues to create my First Playbook on a VM-500 Virtual Palo Alto Firewall

L1 Bithead

Hello Palo Alto Community

 

I've been trying to make work my first Playbook in ansible, to pretty much whatever it works, right now Im trying to create a test address object, but I kept geeting what it looks like, a syntax error this is the configuration of my playbook.

 

The image attached is the error im seeing(Looks like connection to the device is established correctly, is just that something maybe syntax is wrong.), do you have any idea what I might be missing?

 

Thanks in Advance

 

The Galaxy was install correctly

 

ansible-galaxy collection install paloaltonetworks.panos

This is exactly the playbook configuration.

 

- hosts: DEV

  connection: local

 

  vars:

    device:

      ip_address: '{{ 1.1.1.1 }}'

      username:   '{{ 111111111 | default(omit) }}'

      password:   '{{ 111111111 | default(omit) }}'

      api_key:    '{{ supersecretkey | default(omit) }}'

 

  tasks :

    - name: Create address object

      panos_address_object:

        provider: '{{ device }}'

        name: 'Hello-World'

        value: '1.1.1.1'

        description: 'Test'      

 

  collections :

    - paloaltonetworks.panos

 

 

 



Please note you are posting a public message where community members and experts can provide assistance. Sharing private information such as serial numbers or company information is not recommended.
1 accepted solution

Accepted Solutions

L1 Bithead

Hello @fersherls , as you have probably noticed Ansible logging messages could be a little more helpful. It looks like the way you're calling your variables within the playbook is problematic.

 

When you encapsulate some text within double curly braces, you need the text to be the name of a variable.

 

In this example, we encapsulate the word "example" between braces, and this will allow us to call forward the value of an object with that name

 {{ example }} 

 

So in the original, we see that you're trying to store the value of objects in curly braces. this will confuse Ansible, which will look for a variable named 1.1.1.1 and set the value of that object to `ip_address`

 

 

ip_address: '{{ 1.1.1.1 }}'

 

 

should look like this instead. 

 

 

ip_address: '1.1.1.1'

 

 

additional issue with the username and password you're calling, as Ansible requires that a variable name begin with a string

 

 

username:   '{{ 111111111 | default(omit) }}'
password:   '{{ 111111111 | default(omit) }}'

 

 

should look like either of these, with the first example calling for the values of objects named my_username_variable and my_password_variable.

 

 

username:   '{{ my_username_variable | default(omit) }}'
password:   '{{ my_password_variable | default(omit) }}'

username:   'admin'
password:   'password123'

 

 

 

Please let me know if this helps, 

 

Calvin

View solution in original post

1 REPLY 1

L1 Bithead

Hello @fersherls , as you have probably noticed Ansible logging messages could be a little more helpful. It looks like the way you're calling your variables within the playbook is problematic.

 

When you encapsulate some text within double curly braces, you need the text to be the name of a variable.

 

In this example, we encapsulate the word "example" between braces, and this will allow us to call forward the value of an object with that name

 {{ example }} 

 

So in the original, we see that you're trying to store the value of objects in curly braces. this will confuse Ansible, which will look for a variable named 1.1.1.1 and set the value of that object to `ip_address`

 

 

ip_address: '{{ 1.1.1.1 }}'

 

 

should look like this instead. 

 

 

ip_address: '1.1.1.1'

 

 

additional issue with the username and password you're calling, as Ansible requires that a variable name begin with a string

 

 

username:   '{{ 111111111 | default(omit) }}'
password:   '{{ 111111111 | default(omit) }}'

 

 

should look like either of these, with the first example calling for the values of objects named my_username_variable and my_password_variable.

 

 

username:   '{{ my_username_variable | default(omit) }}'
password:   '{{ my_password_variable | default(omit) }}'

username:   'admin'
password:   'password123'

 

 

 

Please let me know if this helps, 

 

Calvin

  • 1 accepted solution
  • 2276 Views
  • 1 replies
  • 0 Likes
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 LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!