-1

I am completely new to Ansible and cannot find much documentation regarding changing the root password of a Juniper device. What is the framework to do something like this?

This is what I have so far but I am not confident it is correct.

---
- vars: 
  newPassword: "{{ newPassword }}"
- hosts: all
  gather_facts: no
  tasks:
  - name: Update Root user's Password
    user: 
     name: root
     update_password: always 
     password: newPassword
Dhar_
  • 19
  • 3
  • Use the dedicated module: https://docs.ansible.com/ansible/latest/collections/junipernetworks/junos/junos_user_module.html#ansible-collections-junipernetworks-junos-junos-user-module – Zeitounator Jan 24 '22 at 07:30

1 Answers1

1

There is a good introduction regarding Understanding the Ansible for Junos OS Collections, Roles, and Modules with references to the Ansible Collection Junipernetworks.Junos.

As already mentioned in a comment, modules for certain tasks are available including Manage local user accounts on Juniper JUNOS devices.

- name: Set user password
  junipernetworks.junos.junos_user:
    name: ansible
    role: super-user
    encrypted_password: "{{ 'my-password' | password_hash('sha512') }}"
    state: present
U880D
  • 8,601
  • 6
  • 24
  • 40