New to Ansible with a better understanding of RestAPI I'm in the beginning of my learning to write Ansible playbooks.
Currently I like to avoid using the export command or hard-code the API-Key in to the playbook.
The solution seams to be to create a credentials.yml file with the API-key.
I follow the guide on this link https://github.com/meraki/dashboard-api-ansible/blob/main/playbooks/credentials.yml
So the file looks like this:
---
meraki_api_key: "my key"
end-of-file
My playbook yml file I try to use looks like the following:
---
- hosts: meraki_servers
gather_facts: false
tasks:
- name: Get all webhooks httpservers
cisco.meraki.networks_webhooks_http_servers_info:
meraki_suppress_logging: true
networkId: 'My network-ID'
register: result
- name: Show current WebHook Servers
ansible.builtin.debug:
msg: "{{ result }}"
end-of-file
If I add meraki_api_key: "My key " befire the networkId line it works if not I receive an error saying meraki_api_key is missing
Ideas?