msergiy87 / ansible-create-users Goto Github PK
View Code? Open in Web Editor NEWCreate multiple users on multiple servers with different keys and different rights
Create multiple users on multiple servers with different keys and different rights
discover@AZ84ANSP01v playbooks]$ ansible-playbook -v create_ansible_user.yml
Using /opt/anshome/playbooks/ansible.cfg as config file
PLAY [Create Users] ******************************************************************************************************************************************************************
TASK [CreateUsers : include_vars] ****************************************************************************************************************************************************
ok: [az84inf01v.am.freescale.net] => {"ansible_facts": {"users": [{"username": "ram"}, {"username": "ram1"}, {"username": "ram2"}]}, "changed": false}
TASK [CreateUsers : Create Users] ****************************************************************************************************************************************************
failed: [az84inf01v.am.freescale.net] (item={u'username': u'ram'}) => {"failed": true, "item": {"username": "ram"}, "msg": "useradd: invalid user name ''\n", "name": "", "rc": 3}
failed: [az84inf01v.am.freescale.net] (item={u'username': u'ram1'}) => {"failed": true, "item": {"username": "ram1"}, "msg": "useradd: invalid user name ''\n", "name": "", "rc": 3}
failed: [az84inf01v.am.freescale.net] (item={u'username': u'ram2'}) => {"failed": true, "item": {"username": "ram2"}, "msg": "useradd: invalid user name ''\n", "name": "", "rc": 3}
to retry, use: --limit @/opt/anshome/playbooks/create_ansible_user.retry
PLAY RECAP ***************************************************************************************************************************************************************************
az84inf01v.am.freescale.net : ok=1 changed=0 unreachable=0 failed=1
Hi
Thanks for your code, it is very understanding for setting up the user. But I have faced the issue with removing.
Not able to remove the user and also from sudoers file, could you please check and update asap thanks.
I get the following error when I execute:
ansible-playbook create_users.yml
ERROR! failed at splitting arguments, either an unbalanced jinja2 block or quotes: user={{ item.username }} key="[[ lookup('file', 'pub_keys/{{ item.username }}.pub') ]]" path="/home/{{ item.username ]]/.ssh/authorized_keys" manage_dir=no
The error appears to have been in '/home/fyakin/create_users.yml': line 22, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Setup | authorized key upload
^ here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.