Code Monkey home page Code Monkey logo

Comments (1)

stacywsmith avatar stacywsmith commented on July 20, 2024

In general async mode has not been thoroughly tested. It may or may not work...

With that said, this particular issue is now resolved using the new juniper_junos_config module.

This playbook is equivalent to the problematic playbook described in this issue:

---
- name: 'Get config async'
  hosts: junos-all
  connection: local
  gather_facts: no
  roles:
    - Juniper.junos

  tasks:
    - name: 'Get config async'
      juniper_junos_config:
        retrieve: 'candidate'
        dest_dir: 'configs/'
        return_output: false
      async: 45
      poll: 1
      register: response
    - name: 'Print result'
      debug:
        var: response

Before the playbook is executed, there are no files in the configs directory:

user@h0:~$ ls configs/*
ls: cannot access configs/*: No such file or directory

The playbook is executed:

user@h0:~/Automation/Projects/Ansible/playbooks/galaxy/test/ansible-module-integration-tests$ ansible-playbook -k pb.test.yaml 
SSH password: 

PLAY [Get config async] ************************************************************************************************

TASK [Get config async] ************************************************************************************************
ok: [r2]
ok: [r3]
ok: [r0]
ok: [r1]
ok: [r4]
ok: [r5]

TASK [Print result] ****************************************************************************************************
ok: [r0] => {
    "response": {
        "ansible_job_id": "674835105386.15735", 
        "changed": false, 
        "failed": false, 
        "finished": 1, 
        "msg": "Configuration has been: opened, retrieved, closed."
    }
}
ok: [r1] => {
    "response": {
        "ansible_job_id": "800698725995.15748", 
        "changed": false, 
        "failed": false, 
        "finished": 1, 
        "msg": "Configuration has been: opened, retrieved, closed."
    }
}
ok: [r2] => {
    "response": {
        "ansible_job_id": "407425598223.15745", 
        "changed": false, 
        "failed": false, 
        "finished": 1, 
        "msg": "Configuration has been: opened, retrieved, closed."
    }
}
ok: [r3] => {
    "response": {
        "ansible_job_id": "188688322208.15744", 
        "changed": false, 
        "failed": false, 
        "finished": 1, 
        "msg": "Configuration has been: opened, retrieved, closed."
    }
}
ok: [r4] => {
    "response": {
        "ansible_job_id": "836892044079.15732", 
        "changed": false, 
        "failed": false, 
        "finished": 1, 
        "msg": "Configuration has been: opened, retrieved, closed."
    }
}
ok: [r5] => {
    "response": {
        "ansible_job_id": "579428204334.15746", 
        "changed": false, 
        "failed": false, 
        "finished": 1, 
        "msg": "Configuration has been: opened, retrieved, closed."
    }
}

PLAY RECAP *************************************************************************************************************
r0                         : ok=2    changed=0    unreachable=0    failed=0   
r1                         : ok=2    changed=0    unreachable=0    failed=0   
r2                         : ok=2    changed=0    unreachable=0    failed=0   
r3                         : ok=2    changed=0    unreachable=0    failed=0   
r4                         : ok=2    changed=0    unreachable=0    failed=0   
r5                         : ok=2    changed=0    unreachable=0    failed=0   

Files are now present in the configs directory:

user@h0:~$ ls configs/*
configs/r0.config  configs/r1.config  configs/r2.config  configs/r3.config  configs/r4.config  configs/r5.config

from ansible-junos-stdlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.