Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible DNAC REST module #53

Open
beye91 opened this issue Mar 23, 2022 · 4 comments
Open

Ansible DNAC REST module #53

beye91 opened this issue Mar 23, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@beye91
Copy link

beye91 commented Mar 23, 2022

Is your feature request related to a problem? Please describe.
There are always REST calls that are not implemented and it would be great to have an Ansible module like other Cisco products for example ACI: https://docs.ansible.com/ansible/latest/collections/cisco/aci/aci_rest_module.html

Describe the solution you'd like
A module that only focuses on the payload and not dealing with authentication and saving the TOKEN in a separate variable.

Describe alternatives you've considered
An alternative solution is the ansible.builtin.uri

@beye91
Copy link
Author

beye91 commented Mar 23, 2022

For example:

- hosts: dnac_servers
  vars_files:
    - credentials.yml
    - vars.yml
  vars:
    get_devices_url: "https://{{dnac_host}}:{{dnac_port}}/dna/intent/api/v1/network-device"
    auth_url: "https://{{dnac_host}}:{{dnac_port}}/dna/system/api/v1/auth/token"
    deviceID_lookup: "{{playbook_dir}}/DEVICE_ID_LOOKUP.yaml"
  gather_facts: no
  connection: local
  tasks:
    - name: authenticate to DNAC and get token as env variable
      uri:
        url: "{{auth_url}}"
        method: POST
        user: "{{dnac_username}}"
        password: "{{dnac_password}}"
        headers:
          Content-Type: "application/json"
          Accept: "application/json"
        status_code: 200
        force_basic_auth: yes
        validate_certs: "{{dnac_verify}}"
      register: auth_response
    - debug:
        var: auth_response.json.Token

    - name: get list of devices
      uri:
        url: "{{get_devices_url}}"
        method: GET
        validate_certs: "{{dnac_verify}}"
        headers:
          x-auth-token: "{{auth_response.json.Token}}"
          Content-Type: "application/json"
          Accept: "application/json"
        status_code: 200
      register: dev_list
    - debug:
        var: dev_list.json.response 

I would like to avoid that and it can be much more simpler.

Cheers, Chris

@jbogarin jbogarin added the enhancement New feature or request label Mar 24, 2022
@jbogarin
Copy link
Collaborator

Thanks for the enhancement idea. We will figure out if we can include it in the next release.

@MTWiley
Copy link

MTWiley commented Sep 11, 2023

I'd like to second the request or bubble it back up to the top.

As the original poster mentioned having a relatively simple workaround for any use-case that you don't currently have a module for would be very helpful.

@zapodeanu
Copy link

@MTWiley We will review this when we release the next library version.

fmunozmiranda pushed a commit that referenced this issue Dec 19, 2023
Adding bulk addition and bulk deletion, along with variable names cha…
fmunozmiranda pushed a commit that referenced this issue Jun 7, 2024
latest changes May 6th 2024
syed-khadeerahmed pushed a commit to syed-khadeerahmed/dnacenter-ansible that referenced this issue Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants