Refactor and require user to manage 'become'

This commit is contained in:
Santiago Lo Coco 2024-04-13 21:35:14 +02:00
parent 6a91dfcfe4
commit a330660cea
8 changed files with 8 additions and 9 deletions

View File

@ -20,7 +20,7 @@ Example Playbook
```yaml
- hosts: servers
vars:
local_users:
accounts:
- name: test_user1
shell: /bin/bash
userid: 1001

View File

@ -1,2 +1,2 @@
---
local_users: []
accounts: []

View File

@ -3,7 +3,7 @@ argument_specs:
main:
short_description: Ansible Role to create local users
options:
local_users:
accounts:
type: list
required: true
elements: dict
@ -34,4 +34,4 @@ argument_specs:
type: list
required: false
default: ""
description: The primary group for the local user.
description: The primary group for the local user.

View File

@ -4,6 +4,6 @@ galaxy_info:
company: cloudWerkstatt
license: MIT
min_ansible_version: 2.12.0
galaxy_tags: ['users']
galaxy_tags: ['users', 'creation']
dependencies: []

View File

@ -8,5 +8,4 @@
home: "{{ item.home | default(omit) }}"
groups: "{{ item.groups | default(omit) }}"
generate_ssh_key: yes
loop: "{{ local_users }}"
become: true
loop: "{{ accounts }}"

View File

@ -1,2 +1 @@
localhost

View File

@ -3,6 +3,7 @@
hosts: localhost
connection: local
gather_facts: no
become: true
vars:
local_users: