junos_jsnapy

Author:Roslan Zaki & Damien Garros, Juniper Networks

Synopsis

New in version 1.4.0.

Execute JSNAPy test from Ansible. Attention, to not break Ansible behavior, this module only report “failed” if the module itself fails, not if a test fails. To check the test results you need to subscribe to the result and assert the returned value. An experimental Callback_Plugin for junos_jsnapy is available to provide additional information about tests that failed. To enable it, you need to add “callback_whitelist = jsnapy” in your ansible configuration file.

Options

parameter required default choices comments
action yes None
    Possible actions available - jsnapcheck - check - snap_pre - snap_post
    config_file yes None
      The YAML configuration file for the JSNAPy tests
      dest yes None
        Path to the local server directory where configuration will be saved.
        dir no /etc/jsnapy/testfiles
          Path for the JSNAPy yaml configuration file
          host yes
            Set to {{ inventory_hostname }}
            logfile no None
              Path on the local server where the progress status is logged for debugging purposes
              mode no None
                mode of console connection (telnet/serial). If mode is not provided SSH connection is used.
                passwd no assumes ssh-key active
                  Login password
                  port no 830
                    port number to use when connecting to the device
                    test_files no None
                      Test files which need to executed
                      user no $USER
                        Login username

                        Note

                        Requires junos-eznc >= 1.2.2

                        Examples


                           - name: JUNOS Post Checklist
                             junos_jsnapy:
                               host: "{{ inventory_hostname}}"
                               passwd: "{{ tm1_password }}"
                               action: "snap_post"
                               config_file: "first_test.yml"
                               logfile: "migration_post.log"
                             register: test1
                        
                           - name: Check JSNAPy tests results
                             assert:
                             that:
                               - "test1.passPercentage == 100"
                        
                           - name: Debug jsnapy
                             debug: msg=test1
                        
                        ---------
                           - name: Test based on a test_file directly
                             junos_jsnapy:
                               host: "{{ junos_host }}"
                               port: "{{ netconf_port }}"
                               user: "{{ ansible_ssh_user }}"
                               passwd: "{{ ansible_ssh_pass }}"
                               test_files: tests/test_junos_interface.yaml
                               action: snapcheck
                             register: test1
                        
                           - name: Check JSNAPy tests results
                             assert:
                             that:
                               - "test1.passPercentage == 100"