ansible-role-admin-users
ansible-role-admin-users copied to clipboard
Task "create admin user groups" fails
Hello, I am new to Ansible so forgive if I lack info that you may need
The role fails at the create admin user groups with the message 'unicode object' has no attribute 'username', I tried also to use admin_user_groups: false in the hope that the task would be skipped or something, but to no avail.
The target machines are 2x Ubuntu 16.04, 1x Debian 9, 1x ArchLinux (and one linux mint, but I know it is not supported)
ansible 2.4.3.0 on MacOS 10.12.6, role version latest 0.7.1
Let me know if you need more info or if I just did a n00b mistake, google didn't help me much!
Can you see which version of Jinja2 you have installed? I'd added a change in f6acd6669a7a60f28e56772ae6b3c778d3ed1b31 that requires creating a custom filter for older versions of Jinja2.
It would also be helpful to see an example of your admin_users variable you're passing to the role.
Thanks for the fast reply!
- username: "linuxbandit"
shell: "/bin/zsh"
pubkey: "https://github.com/linuxbandit.keys"
admin_users_sudo_nopasswd: false
admin_user_groups: false
- username: "ansible"
shell: "/bin/false
pubkey: "https://github.com/linuxbandit.keys"
admin_users_sudo_nopasswd: true
admin_user_groups: false
pip list does not show jinja indeed but could it be because the package is installed through virtualenv? Through Ansible? Through your role? I am still googling how to get the info, let's see if you'll be faster in replying and hinting a fast how-to :p
thanks to this I have
ok: [localhost] => {"changed": false, "msg": "2.10"}
How to downgrade jinja/get around it without downgrading?
Thanks!
The indention looks off on the list of admin users you pasted, but that may just be an issue with copying/pasting into GitHub. If you want to set admin_users_sudo_nopasswd or admin_user_groups, you'll need to set those somewhere other than in the list of users, either in inventory variables, vars in the play, or as parameters where you use the role.
Jinja2 version 2.10 is actually preferred, since it doesn't use the any of the backported code included in the role.
Hey sorry it took me a while, I moved them as you suggested and I do have Jinja 2.10, also upgraded your role to 0.7.2, now the errors are
TASK [cchurch.admin-users : create admin user groups] **************************
[DEPRECATION WARNING]: Skipping task due to undefined attribute, in the future this will be a fatal error.. This feature will be
removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
TASK [cchurch.admin-users : create admin users] ********************************
[DEPRECATION WARNING]: Skipping task due to undefined attribute, in the future this will be a fatal error.. This feature will be
removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
and TASK [cchurch.admin-users : update multiple authorized keys for admin users] *** fatal: [ansibleazure]: FAILED! => {"failed": true, "msg": "ERROR! subelements lookup expects a dictionary, got 'd'"}
yes the indentation was off only because of github copypaste. Any advice? Thank you very much!