Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eos_user does not set variables on first task execution #411

Open
jorisc90 opened this issue Mar 30, 2023 · 1 comment
Open

eos_user does not set variables on first task execution #411

jorisc90 opened this issue Mar 30, 2023 · 1 comment
Assignees

Comments

@jorisc90
Copy link

jorisc90 commented Mar 30, 2023

SUMMARY

eos_user requires a second task to set variables such as privilege level and role. The first time the task runs it creates the user, but fails to set the extra variables

ISSUE TYPE
  • Bug Report
COMPONENT NAME

eos_user

ANSIBLE VERSION
ansible [core 2.12.8]
  config file = /home/coder/.ansible.cfg
  configured module search path = ['/home/coder/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
  ansible collection location = /home/coder/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
  jinja version = 3.1.2
  libyaml = True

COLLECTION VERSION

# /home/coder/.ansible/collections/ansible_collections
Collection Version
---------- -------
arista.eos 5.0.1  

CONFIGURATION
HOST_KEY_CHECKING(/home/coder/.ansible.cfg) = False
OS / ENVIRONMENT

Ansible running on CentOS VM:

Linux 2ace49c7c14b 5.4.132-1.el7.elrepo.x86_64 #1 SMP Wed Jul 14 07:42:43 EDT 2021 x86_64 GNU/Linux

Target OS is cEOS-lab:

Software image version: 4.27.2F-26069621.4272F (engineering build)
STEPS TO REPRODUCE

Create new user using eos_user module, providing extra variables such as privilege level and role

---
  - hosts: leaf1-DC2
    gather_facts: no
    tasks:
    - name: Add User
      eos_user:
        name: automator 
        nopassword: yes
        privilege: 15
        role: network-admin
        state: present

    - name: Add SSH key
      eos_user:
        name: automator
        sshkey: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
        state: present

EXPECTED RESULTS

Expected the following output in EOS CLI: leaf1-DC2#show run sec automator username automator privilege 15 role network-admin nopassword username automator ssh-key ssh-rsa <key>

ACTUAL RESULTS

Playbook produces the following output on first execution:

username automator nopassword
username automator ssh-key ssh-rsa <key> 

https://gist.github.com/jorisc90/f808d51f86b87fde4194c937da267d45

Playbook produces the expected result when running the same task again:

username automator privilege 15 role network-admin nopassword
username automator ssh-key ssh-rsa <key>

https://gist.github.com/jorisc90/b00280bab3630c15093dae13413fe8cb

@rohitthakur2590 rohitthakur2590 self-assigned this Apr 5, 2023
@kirk444
Copy link

kirk444 commented Oct 28, 2024

I can confirm that I see the same behavior as the original submitter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants