Code Monkey home page Code Monkey logo

ansible-create-users's Introduction

ansible-create-users

Create on each server (file hosts) users from the list (file users.yml).

ansible-create-users

User Settings

  • Shell = /bin/bash
  • Add the public key in pub_keys dir (username.pub)
  • In users.yml specify that user should have the right to sudo or not

Distros tested

Currently, this is only tested on Ubuntu 14.04 as a client and server machine. It should theoretically work on older versions of Ubuntu or Debian based systems.

Usage

  • install ansible
  • create keys
  • configure client server authorized_keys
  • upload repository and change
  • run command
ansible-playbook -i hosts create_users.yml

ansible-create-users's People

Contributors

msergiy87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ansible-create-users's Issues

am facing an error like invalid user

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

Issue with create_users.yml

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

not able to remove the user and also from sudoers ?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.