https://www.juniper.net/documentation/us/en/software/junos-ansible/ansible/topics/task/junos-ansible-playbooks-creating-executing.html
On Thu, 16 Dec 2021 at 20:21, nishant shah <linkton...@gmail.com> wrote: > Hi, > > I am working on managing Juniper devices using Ansible. I am trying to add > a new user using a playbook- > > *PLAYBOOK-* > --- > - name: create new User Name > hosts: all > roles: > - "/root/.ansible/roles/juniper.junos" > #connection: local > gather_facts: no > tasks: > - name: New user > juniper.device.config: > config_mode: "private" > load: "set" > src: "/home/ansible-content/username.set" > diff: true > check: true > commit: true > register: response > - name: Print the changes > debug: > var: response > > *Ansible Version* > [root@ansiblectrl ansible-content]# ansible --version > [DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the > controller starting with Ansible 2.12. Current version: 3.6.8 (default, Nov > 16 2020, 16:55:22) [GCC 4.8.5 > 20150623 (Red Hat 4.8.5-44)]. This feature will be removed from > ansible-core in version 2.12. Deprecation warnings can be disabled by > setting deprecation_warnings=False in > ansible.cfg. > ansible [core 2.11.7] > config file = /etc/ansible/ansible.cfg > configured module search path = ['/root/.ansible/plugins/modules', > '/usr/share/ansible/plugins/modules'] > ansible python module location = > /usr/local/lib/python3.6/site-packages/ansible > ansible collection location = > /root/.ansible/collections:/usr/share/ansible/collections > executable location = /usr/local/bin/ansible > python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 > 20150623 (Red Hat 4.8.5-44)] > jinja version = 3.0.3 > > *Error I am getting while running the playbook* > PLAY [create new User Name] > ***************************************************************************************************************************************************** > > TASK [New user] > ***************************************************************************************************************************************************************** > An exception occurred during task execution. To see the full traceback, > use -vvv. The error was: AttributeError: 'JuniperJunosModule' object has no > attribute '_pyez_conn' > fatal: [vMX]: FAILED! => {"changed": false, "module_stderr": "Traceback > (most recent call last):\n File > \"/root/.ansible/tmp/ansible-local-45180o9494g96/ansible-tmp-1639681653. > 8275743-45188-118801523556762/AnsiballZ_config.py\", line 100, in > <module>\n _ansiballz_main()\n File > \"/root/.ansible/tmp/ansible-local-45180o9494g96/ansible-tmp-1639681653 > .8275743-45188-118801523556762/AnsiballZ_config.py\", line 92, in > _ansiballz_main\n invoke_module(zipped_mod, temp_path, > ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansibl > > e-local-45180o9494g96/ansible-tmp-1639681653.8275743-45188-118801523556762/AnsiballZ_config.py\", > line 41, in invoke_module\n run_name='__main__', alter_sys=True)\n File > \"/ usr/lib64/python3.6/runpy.py\", line 205, in run_module\n return > _run_module_code(code, init_globals, run_name, mod_spec)\n File > \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n > mod_name, mod_spec, pkg_name, script_name)\n File > \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n exec(code, > run_globals)\n File \"/tmp/ > > ansible_juniper.device.config_payload_rkavhxwl/ansible_juniper.device.config_payload.zip/ansible_collections/juniper/device/plugins/modules/config.py\", > line 1164, in <module>\n File > \"/tmp/ansible_juniper.device.config_payload_rkavhxwl/ansible_juniper.device.config_payload.zip/ansible_collections/juniper/device/plugins/modules/config.py\", > line 887, in main\n File > \"/tmp/ansible_juniper.device.config_payload_rkavhxwl/ansible_juniper.device.config_payload.zip/ansible_collections/juniper/device/plugins/module_utils/juniper_j > unos_common.py\", line 620, in __init__\n File > \"/tmp/ansible_juniper.device.config_payload_rkavhxwl/ansible_juniper.device.config_payload.zip/ansible_collections/juniper/devic > e/plugins/module_utils/juniper_junos_common.py\", line 690, in > get_connection\n File > \"/tmp/ansible_juniper.device.config_payload_rkavhxwl/ansible_juniper.device.config_payload > > > .zip/ansible_collections/juniper/device/plugins/module_utils/juniper_junos_common.py\", > line 726, in fail_json\n File > \"/tmp/ansible_juniper.device.config_payload_rkavhxwl/ansi > > ble_juniper.device.config_payload.zip/ansible_collections/juniper/device/plugins/module_utils/juniper_junos_common.py\", > line 1172, in close_configuration\nAttributeError: 'Juni perJunosModule' > object has no attribute '_pyez_conn'\n", "module_stdout": "", "msg": > "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1} > > PLAY RECAP > ********************************************************************************************************************************************************************** > vMX : ok=0 changed=0 unreachable=0 > failed=1 skipped=0 rescued=0 ignored=0 > > Thanks, > Nish > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to ansible-project+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/2588c9ca-e841-4b5a-8fff-c1a277056a00n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/2588c9ca-e841-4b5a-8fff-c1a277056a00n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Sent from a mobile device - please excuse the brevity, spelling and punctuation. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwMb6_JSuRd%2BXkev22gWGmy8s3%2BMVK%3DTOVNbVvSTJyZ89Q%40mail.gmail.com.