I have a role that I am calling for simple user administration. I 
appreciate any feedback on what I am doing.

First of all here is the command line that I am running:

ansible-playbook -i inventories/rd general_users.yml --extra-vars 
"target=haproxy targetusers=bastionusers" -u <redacted> -K

The playbook will start fine and collects host data and properly pulls in 
my users.yml. Then when the actual user addition task fires off I get the 
following error:

fatal: [server1]: FAILED! => {"failed": true, "msg": "ERROR! 'unicode 
object' has no attribute 'comment'"}
fatal: [server2]: FAILED! => {"failed": true, "msg": "ERROR! 'unicode 
object' has no attribute 'comment'"}


*general_users.yml*---
- hosts: '{{ target }}'

  become: yes
  tasks:
  roles:
    - { role: user_management, sudogroup: 'sudo', when: 
ansible_distribution == "Ubuntu" or ansible_distribution == "Debian" }
    - { role: user_management, sudogroup: 'wheel', when: 
ansible_distribution == "CentOS" or ansible_distribution == "Amazon" }

*Role: user_management*

*tasks: main.yml*
---
- include: users.yml


*tasks: users.yml*---
- name: Adding users to bastion server.
  user: name="{{ item.username }}" comment="{{ item.comment }}" uid="{{ 
item.userid }}" password="{{ item.password }}" shell='/bin/bash' 
update_password="{{ item.updatepassword }}"
  with_items:
    - "{{ targetusers }}"

- name: Adding users public keys for users.
  authorized_key: user="{{ item.username }}" key="{{ lookup('file', 
'keys/{{ item.username }}.pub') }}"
  with_items:
    - "{{ targetusers }}"



*vars: main.yml*bastionusers:
  - { username: jblow, comment: Joe Blow, userid: 12000, password: 
$6$KTjoXb2b8u4fbctM$FPuJyXaRUiFeQq8lxGp/3pxC.YYvtK/7uXGgxvMHc/DWbRPbtpYpI4pgwaXXfXt8Im2FJ09wndLCKFO8I0bTZ0,
 
updatepassword: on_create }


I am not sure what I am doing wrong here, but this is not working. I am 
probably missing something extremely simple, but have been at it too long 
to see it.

Thanks

Grim76

-- 
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/01b3da84-352a-47fa-9d07-4389e440c8e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to