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

arubaoss_config_bkup - unable to load response from device #72

Open
adparis99 opened this issue Mar 29, 2023 · 5 comments
Open

arubaoss_config_bkup - unable to load response from device #72

adparis99 opened this issue Mar 29, 2023 · 5 comments

Comments

@adparis99
Copy link

adparis99 commented Mar 29, 2023

Hey there, I'm trying to use the arubaoss_config_bkup module to backup device configurations for some of our Aruba equipment, but I haven't gotten it to work so far.

Here is my playbook:

- name: Get Config For HP Switches
  hosts: host
  collections:
    - arubanetworks.aos_switch
  gather_facts: no
  vars:
    ansible_network_os: arubanetworks.aos_switch.arubaoss
    ansible_user:  username
    ansible_password: password
    ansible_connection: local
    
  tasks:
    - name: Backup HP Switch Configuration
      arubaoss_config_bkup: 
        file_name: /path/to/backup.txt
        config_type: CT_RUNNING_CONFIG

Here is the output of the task:

    "changed": false,
    "data": "",
    "invocation": {
        "module_args": {
            "api_version": "v8.0",
            "config_type": "CT_RUNNING_CONFIG",
            "file_name": "/path/to/backup.txt",
            "forced_reboot": null,
            "host": "ip_address_here",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 80,
            "provider": {
                "api_version": null,
                "host": "ip_address_here",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "port": 80,
                "ssh_keyfile": null,
                "timeout": 30,
                "transport": "aossapi",
                "use_proxy": false,
                "use_ssl": false,
                "username": "username",
                "validate_certs": false
            },
            "recovery_mode": null,
            "server_ip": null,
            "server_name": null,
            "server_passwd": null,
            "server_type": null,
            "sftp_port": 22,
            "ssh_keyfile": null,
            "state": "create",
            "timeout": 30,
            "use_ssl": false,
            "user_name": null,
            "username": "username",
            "validate_certs": false,
            "wait_for_apply": true
        }
    },
    "msg": "unable to load response from device"

ansible_host is defined in hostvars, and I'm explicitly defining the needed environment variable at runtime. Any thoughts on why I might be getting this error?

@alagoutte
Copy link
Contributor

Hi,

Do you have check the switch config ? (you are using HTTP ? not HTTPS ?)

@tchiapuziowong
Copy link
Member

tchiapuziowong commented Apr 3, 2023

Hi @adparis99 I don't believe this is the correct module for what you're trying to accomplish- it seems you're trying to backup the configuration of the switch to a local file? If so you would want to use the arubaoss_config module which uses SSH to connect to the switch and retrieve the running configuration. Remember when using this module you'll want to ensure you have the ansible_connection: network_cli variable set, for further instructions see here.

Here's the entire playbook, please let me know if you run into additional errors with this:

- hosts: all
  collections:
    - arubanetworks.aos_switch
  gather_facts: False
  vars:
    ansible_connection: network_cli
  tasks:
    - name: Backup config to local file
      arubaoss_config:
        backup: True
        backup_options:
          filename: backup.txt
          dir_path: /path/to

@adparis99
Copy link
Author

Ah, gotcha! I was looking here and here, which seemed to imply I could use arubaoss_config_bkup to get it via the API. In any case, I'll give this a try. Thanks for the help!

@Flamme-2
Copy link

Flamme-2 commented Apr 25, 2023

Hello,

I have the same issue when I try to configure ntp server.
My task in playbook :

  - name: Set NTP server
    arubaoss_ntp:
      command: "config_ntp_ipv4addr"
      ntp_ip4addr: "192.168.10.3"
      mode: "burst"
      api_version: "{{ ansible_api_version }}"
      use_ssl: "{{ ansible_use_ssl }}"
      port: "{{ ansible_port }}"
      host: "{{ ansible_host }}"
      username: "{{ ansible_user }}"
      password: "{{ ansible_password }}"
    delegate_to: "{{ passthrough }}"
    remote_user: "{{ hostvars[passthrough].ansible_user }}"
    vars:
      ansible_ssh_private_key_file: "{{ hostvars[passthrough].ansible_ssh_private_key_file }}"
    tags:
      - system
      - ntp

Error occured :

FAILED! => {
"changed": false,
"data": "",
"invocation": {
"module_args": {
"api_version": "v8.0",
"association_value": 8,
"authenticationMode": "md5",
"command": "config_ntp_ipv4addr",
"config": "create",
"host": "192.168.18.20",
"include_credentials_in_response": "ICS_ENABLED",
"keyId": 0,
"keyValue": "",
"maxpoll_value": 10,
"minpoll_value": 6,
"mode": "burst",
"ntp_ip4addr": "192.168.10.3",
"operate": "broadcast",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"port": 443,
"provider": null,
"ssh_keyfile": null,
"timeout": null,
"timesyncType": "timep-or-sntp",
"trap_value": null,
"trusted": true,
"use_oobm": false,
"use_ssl": true,
"username": "admin",
"validate_certs": false
}
},
"msg": "unable to load response from device"
}

BUT if the configuration in the switch is already set, no error is reported (I juste IP is changed).

OK => {
"changed": false,
"invocation": {
"module_args": {
"api_version": "v8.0",
"association_value": 8,
"authenticationMode": "md5",
"command": "config_ntp_ipv4addr",
"config": "create",
"host": "192.168.18.20",
"include_credentials_in_response": "ICS_ENABLED",
"keyId": 0,
"keyValue": "",
"maxpoll_value": 10,
"minpoll_value": 6,
"mode": "burst",
"ntp_ip4addr": "192.168.10.2",
"operate": "broadcast",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"port": 443,
"provider": null,
"ssh_keyfile": null,
"timeout": null,
"timesyncType": "timep-or-sntp",
"trap_value": null,
"trusted": true,
"use_oobm": false,
"use_ssl": true,
"username": "admin",
"validate_certs": false
}
},
"ip4addr": {
"ip4addr_reference": {
"burst": true,
"max-poll": {
"max-poll_value": 10
},
"min-poll": {
"min-poll_value": 6
}
},
"ip4addr_value": "192.168.10.2"
},
"uri": "/config/ntp/server/ip4addr/192.168.10.2"
}

Conf of switch :

timesync ntp
ntp server 192.168.10.2 burst
ntp enable

PS :

  • Another modules working without any issue (like vlan, dns, motd...)

@chr00ted

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants