Giter Site home page Giter Site logo

ansible-role-users's People

Contributors

1it avatar petemcw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

kefirgames

ansible-role-users's Issues

with_subelements don't skip users in list

Hi,

Thanks for sharing this ansible role !
I have an issue, on skiping task with with_subelements loop
Espected Results :
Ansible should ignore the user from list , once the condition wasn't satisfied.

See below ansible config :

users: 
  - username: ''TOTO'
    uid: 1000               
    authorized: ['ssh-rsa DFSDKJFDFKLVJDFVKLJ']           
    state: 'present'
    addpukey:  true
  - username: 'TITI'
     uid: 1002
     state: present

The condition i have added is :

 when:
    - users is iterable 
    - item.0.addpukey is defined 

the error raised :

"msg": "could not find 'authorized' key in iterated item '

thanks for answers

user gets created on hosts where it should not

Hi Ivan,

thanks for enabling issues on the repo and thanks for your blogpost covering this role.

While reading your role tasks I was wondering why it would not create all users as soon as do_run is set, and in fact testing confirmed this issue.

Test case is using this users list:

    users:
      - username: 'ansibletest'
        authorized:
          - "ssh-ed25519 AAAAC3NzaC1l123"
        name: 'System Administrator'
        target_hosts:
          - "ungrouped"
        state: 'present'
      - username: 'donotcreate'
        authorized:
          - "ssh-ed25519 AAA123"
        name: 'foo'
        target_hosts:
          - "bla"
        state: 'present'

If you run this against an ungrouped host, you would expect that it creates the user ansibletest but in fact both get created, because "Determine target hosts" sets do_run to True and do_run is a host-wide fact.

I'm also working on a solution for the problem by adding " - item.target_hosts in group_names" to the conditions of the task "Manage user accounts", but that does no longer support a list of target_hosts (it requires target_hosts to be just a string).

Looking forward to your input.

Problem when users_group_list variable is set to [] per default

When the variable users_group_list variable is set to [], which is the default, a new empty group with the name "[]" is created on the target servers. The gid of this group is one above the latest normal group which is created by the role.

I am using the latest version of this role with ansible 2.10.8. My users are defined in the group_vars/all file in my inventory and look the following:

users:

  • username: 'cs'
    name: 'My Name'
    comment: 'My Name'
    uid: '1010'
    gid: '1010'
    users_group_list: []
    authorized:

    • 'ecdsa-sha2-nistp521...'
      generate_key: false
      state: 'present'
      target_hosts:
    • all
  • username: 'monitoring'
    name: 'Monitoring service account'
    uid: '2001'
    gid: '2001'
    users_group_list: []
    authorized: []
    generate_key: false
    state: 'present'
    target_hosts:

    • all

I've also tried it without the users_group_list: [] entry in the user definitions without success.

Have you any idea what causes the [] group entry on my systems?

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.