Got it ! Thanks Alex for taking the time to respond !

Elie

On Wed, Feb 12, 2020, 5:13 PM 'Alex King' via Ansible Project <
[email protected]> wrote:

> I had the same problem.  It seem like it is a shortcoming of the nxos_user
> module.  It seems like roles are checked against a hard-coded list of
> standard roles, and the module can't work with user defined roles at all.
>
> Thanks,
> Alex
>
> On Saturday, February 9, 2019 at 6:39:56 AM UTC+13, Eliezer Rodriguez
> wrote:
>>
>>
>> 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 a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/htMqABXUmSs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/435920ed-0ee8-4529-93a2-d86ab73fb58a%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/435920ed-0ee8-4529-93a2-d86ab73fb58a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJ23OebxArrRMV%2Bi%2B_fo-m3g7Q2QQ5VBWLLkeYbVyhaihzObgA%40mail.gmail.com.

Reply via email to