Automation

 View Only
last person joined: 6 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Ad-hoc command suboptions via cli

    Posted 12-17-2021 09:27
    Hello,

    I'm starting to work on junos automation with Ansible.

    Here are some configuration informations:

    ansible 2.9.6
    python version = 3.8.10

    As I am starting to understand step by step the way it works, I am trying to use the Ad-hoc commands directly on my labs equipments, not through playbooks.

    But I am getting some troubles to launch those commands using some of junos modules such as "junos_interfaces", whereas it is really well working with "junos_user" module for example.

    I think I have problems with the syntax to be used with the "junos_interfaces" module as it has suboptions in the arguments:


    - name: "Replaces device configuration of listed interfaces with provided configuration"
    junos_interfaces:
    config:
       - name: ge-0/0/2
       description: 'Configured by Ansible-2'
    state: replaced


    I tried so many commands with no success, such as the following one (sw_core_lab_qfx5100 is my lab equipment) :

    ansible sw_core_lab_qfx5100 -m junos_interfaces -a 'config="name=ge-0/0/2 description=Configured by Ansible-2" state="replaced"' -u test_user --ask-pass --connection local


    Can someone please help me to get the correct syntax to be used to use this module correctly?


    Thank you in advance!


  • 2.  RE: Ad-hoc command suboptions via cli

    Posted 12-18-2021 09:25
    Getting started in your lab I would recommend you just follow along the chapter layer in this free Juniper Day One book Automating Junos with Ansible.

    https://www.juniper.net/documentation/en_US/day-one-books/DO_AJA2ndEd.pdf

    And for Python check out the setup, getting started and examples in the Juniper Day One PyEZ cookbook.

    https://www.juniper.net/documentation/en_US/day-one-books/DO_PyEZ_Cookbook.pdf

    ------------------------------
    Steve Puluka BSEET - Juniper Ambassador
    IP Architect - DQE Communications Pittsburgh, PA (Metro Ethernet & ISP)
    http://puluka.com/home
    ------------------------------



  • 3.  RE: Ad-hoc command suboptions via cli

    Posted 12-20-2021 05:45
    Hello Steve,

    Thank you for the reply, but I have already tried to find the answers to my questions into thoses books without success...

    I even tried to configure the exact same  playbooks as the one in the books, but they didn't work... That must be a problem of configuration in my equipments.

    But at least I just wanted to know what's the correct syntax to use in the cli ad-hoc commands to use suboptions.

    Thank you again.


  • 4.  RE: Ad-hoc command suboptions via cli

    Posted 12-30-2021 05:45
    Hello,

    I finally stop trying to launch ad-hoc commands and start making my own playbook, and it's working very well!

    Thank you for your reply.