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

Task "create admin user groups" fails #6

Open
linuxbandit opened this issue Mar 23, 2018 · 5 comments
Open

Task "create admin user groups" fails #6

linuxbandit opened this issue Mar 23, 2018 · 5 comments

Comments

@linuxbandit
Copy link

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!

@cchurch
Copy link
Owner

cchurch commented Mar 23, 2018

Can you see which version of Jinja2 you have installed? I'd added a change in f6acd66 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.

@linuxbandit
Copy link
Author

linuxbandit commented Mar 24, 2018

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

@linuxbandit
Copy link
Author

thanks to this I have
ok: [localhost] => {"changed": false, "msg": "2.10"}

How to downgrade jinja/get around it without downgrading?

Thanks!

@cchurch
Copy link
Owner

cchurch commented Mar 26, 2018

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.

@linuxbandit
Copy link
Author

linuxbandit commented Jul 5, 2018

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!

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

2 participants