cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
818
Views
1
Helpful
1
Replies

Unable to upload config file from Cisco WLC using Ansible Playbook

Timur A
Level 1
Level 1

Hey there,

I'm trying to make a playbook which will send commands to Cisco WLC to send backup config to tftp server.

While i'm performing manual commands to the WLC the config backup are uploading to my tftp server without any case.

Here is my set of commands which i perform manually:

(Cisco Controller) >transfer upload mode tftp
(Cisco Controller) >transfer upload datatype config
(Cisco Controller) >transfer upload filename backup_config.cfg
(Cisco Controller) >transfer upload path /
(Cisco Controller) >transfer upload serverip 99.99.99.99
(Cisco Controller) >transfer upload start
(Cisco Controller) >y

Here is the output from the Cisco WLC:

(Cisco Controller) >transfer upload start

Mode............................................. TFTP
TFTP Server IP................................... 99.99.99.99
TFTP Path........................................ /
TFTP Filename.................................... backup_config.cfg
Data Type........................................ Config File
Encryption....................................... Disabled

**************************************************
*** WARNING: Config File Encryption Disabled ***
**************************************************


Are you sure you want to start? (y/N) y

TFTP Config transfer starting.

File transfer operation completed successfully.

As you see "File transfer operation completed successfully."

 

So i try to perform the same logig and the same set of commands using ansible playbook:

    - name: Set TFTP commands to WLC
      community.network.aireos_command:
        commands:
          - command: transfer upload mode tftp
          - command: transfer upload datatype config
          - command: transfer upload filename backup_config.cfg
          - command: transfer upload path /
          - command: transfer upload serverip 99.99.99.99

    - name: Start transport
      community.network.aireos_command:
        commands:
          - command: transfer download start
            prompt: 'Are you sure you want to start?'
            answer: 'y'
And here i see that WLC are meking something wrong.
Here is the output from the ansible-playbook:
 
ok: [WLC] => {
"changed": false,
"invocation": {
"module_args": {
"commands": [
{
"answer": "y",
"command": "transfer download start",
"prompt": "Are you sure you want to start?"
}
],
"host": null,
"interval": 1,
"match": "all",
"password": null,
"port": null,
"retries": 10,
"ssh_keyfile": null,
"timeout": null,
"username": null,
"wait_for": null
}
},
"stdout": [
"Mode............................................. TFTP\nData Type........................................ Code\nTFTP Server IP................................... 99.99.99.99\nTFTP Packet Timeout.............................. 6\nTFTP Max Retries................................. 10\nTFTP Path........................................ /\nTFTP Filename.................................... backup_config.cfg\n\nThis may take some time.\nAre you sure you want to start? (y/N) y\n\nTFTP Code File type not supported!"
],
"stdout_lines": [
[
"Mode............................................. TFTP",
"Data Type........................................ Code",
"TFTP Server IP................................... 99.99.99.99",
"TFTP Packet Timeout.............................. 6",
"TFTP Max Retries................................. 10",
"TFTP Path........................................ /",
"TFTP Filename.................................... backup_config.cfg",
"",
"This may take some time.",
"Are you sure you want to start? (y/N) y",
"",
"TFTP Code File type not supported!"
]
]
}
 
Why WLC tries to send TFTP Code type, while i asked to send Data type Config File?
Anyone faced this issue?
1 Accepted Solution

Accepted Solutions

Timur A
Level 1
Level 1

Found a missconfig on my Playbook:

I use: transfer download start     command instead of     transfer upload start

Now my PB works fine and task lokks like that:

    - name: Set TFTP commands to WLC
      community.network.aireos_command:
        commands:
          - transfer upload mode tftp
          - transfer upload datatype config
          - transfer upload filename backup_config.cfg
          - transfer upload path /
          - transfer upload serverip 99.99.99.99
          - command: transfer upload start
            prompt: 'Are you sure you want to start?'
            answer: 'y'
The backup_config.cfg file appears at tftp server as expected.

View solution in original post

1 Reply 1

Timur A
Level 1
Level 1

Found a missconfig on my Playbook:

I use: transfer download start     command instead of     transfer upload start

Now my PB works fine and task lokks like that:

    - name: Set TFTP commands to WLC
      community.network.aireos_command:
        commands:
          - transfer upload mode tftp
          - transfer upload datatype config
          - transfer upload filename backup_config.cfg
          - transfer upload path /
          - transfer upload serverip 99.99.99.99
          - command: transfer upload start
            prompt: 'Are you sure you want to start?'
            answer: 'y'
The backup_config.cfg file appears at tftp server as expected.
Review Cisco Networking for a $25 gift card