Hi everybody,

I wrote this playbook to create a new role in Nexus OS and then create a 
new user to use that role.
The role gets created but when it's time for the second task to create the 
role it fails with a non-existent role error.

---
- name: Playing with Nexus OS module
  hosts: all
  gather_facts: false
  vars:
        ansible_connection: network_cli
        ansible_network_os: nxos
tasks:
   - name: create a new role
     nxos_config:
        backup: yes
        lines:
             - rule 10 permit command show policy-map interface input
             - rule 20 permit command show vrf *
             - rule 30 permit command show run vrf *
        parents: role name aegisro

   - name: create a new user
     nxos_user:
        name: aegis_new
        configured_password: <password here>
        state: present
        role: aegisro
  - name: save config
     nxos_config:
          save: yes
...


I get this when running the playbook:

$ ansible-playbook -i ../hosts.ivan --limit bs1.lab aegis-user.yml

PLAY [Playing with Nexus OS module] 
*********************************************************************************************************************************************************************************

TASK [create a new role] 
********************************************************************************************************************************************************************************************
ok: [bs1.lab]

TASK [create a new user] 
********************************************************************************************************************************************************************************************
fatal: [bs1.lab]: FAILED! => {"changed": false, "msg": "invalid role 
specified"}
    to retry, use: --limit 
@/home/elie/ansible-secbu/etc/ansible/playbooks/aegis-user.retry

PLAY RECAP 
**********************************************************************************************************************************************************************************************************
bs1.lab                    : ok=1    changed=0    unreachable=0    failed=1

Any ideas on how to make the second task aware of the role that just got 
created ?

Eliezer R.

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f65d5e87-e4f8-4bb6-ac2c-383b8bade9e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to