Getting error while running an Ansible playbook in aws

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

Getting error while running an Ansible playbook in aws

L1 Bithead

Getting below error:

The error was: botocore.exceptions.NoCredentialsError: Unable to locate credentials

 

when running the playbook, where exactly credentials needs to be stored other vars.yml. Below is the playbook that I am running:

 

- hosts: localhost

  connection: local

  gather_facts: False

 

  roles:

    - role: PaloAltoNetworks.paloaltonetworks

 

  tasks:

    - name: include variables (free-form)

      include_vars: vars.yml

      no_log: 'no'

 

    # Use a template from a URL

    - name: launch ansible cloudformation example

      cloudformation:

        stack_name: "ansible-PANW-NGFW-Deployment"

        state: present

        region: "{{ region }}"

        disable_rollback: true

        template_url: https://s3-us-west-2.amazonaws.com/pantemplates/VM-Series-BYOLv9.json

      args:

        template_parameters:

          FirewallSSHKey: "{{ key_name }}"

        tags:

          Stack: ansible-cloudformation

      register: cloudformation

    - name: display FirewallManagementEIP

      debug:

         msg: "{{ cloudformation.stack_outputs.FirewallManagementEIP }}"

    - name: wait for SSH prompt (timeout 10min)

      wait_for: port=22 host="{{ cloudformation.stack_outputs.FirewallManagementEIP }}" timeout=600

    - name: set admin password

      panos_admpwd: ip_address="{{ cloudformation.stack_outputs.FirewallManagementEIP }}" key_filename="{{key_filename}}" newpassword="{{admin_password}}"

      register: result

      until: not result | failed

      retries: 10

      delay: 30

    - name: configure ethernet1/1 for DHCP

      panos_interface:

        ip_address: "{{ cloudformation.stack_outputs.FirewallManagementEIP }}"

        password: "{{admin_password}}"

        if_name: "ethernet1/1"

        zone_name: "untrust"

        create_default_route: "yes"

        commit: False

    - name: configure ethernet1/2 for DHCP

      panos_interface:

        ip_address: "{{ cloudformation.stack_outputs.FirewallManagementEIP }}"

        password: "{{admin_password}}"

        if_name: "ethernet1/2"

        zone_name: "trust"

        create_default_route: "no"

1 REPLY 1

L5 Sessionator

In all the examples for the Palo Alto Networks role, the vars.yml file is located in the same directory as the playbook, which is the same directory that you're executing ansible-playbook in.

 

Seems like you're not using the Palo Alto Networks Ansible Galaxy role in this playbook, so I guess vars.yml just contains the variables that you're referencing in this playbook.

  • 2845 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!