mirror of
https://github.com/roles-ansible/ansible_collection_users.git
synced 2024-08-16 10:29:50 +02:00
Update variable names
This commit is contained in:
parent
4a131c16fe
commit
48231d5b53
7 changed files with 26 additions and 26 deletions
|
@ -31,10 +31,10 @@ The Option of these directory-variables are the following.
|
|||
|
||||
| name | default value | description |
|
||||
| --- | --- | --- |
|
||||
| l3d_users_user__create_ansible | ``true`` | Create User ansible |
|
||||
| l3d_users_user__ansible_user_state | ``present`` | Create or delete user ansible |
|
||||
| l3d_users_user__set_ansible_ssh_keys | ``false`` | Set SSH Keys for User ansible |
|
||||
| l3d_users_user__ansible_ssh_keys | | SSH public Keys. One per line or as lookup |
|
||||
| l3d_users__create_ansible | ``true`` | Create User ansible |
|
||||
| l3d_users__ansible_user_state | ``present`` | Create or delete user ansible |
|
||||
| l3d_users__set_ansible_ssh_keys | ``false`` | Set SSH Keys for User ansible |
|
||||
| l3d_users__ansible_ssh_keys | | SSH public Keys. One per line or as lookup |
|
||||
| submodules_versioncheck | ``false`` | Optionaly enable simple versionscheck of this role |
|
||||
|
||||
Example Playbook
|
||||
|
@ -61,8 +61,8 @@ The Option of these directory-variables are the following.
|
|||
admin: false
|
||||
pubkeys: "{{ lookup('url', 'https://github.com/do1jlr.keys', split_lines=False) }}"
|
||||
|
||||
l3d_users_user__create_ansible: true
|
||||
l3d_users_user__set_ansible_ssh_keys: true
|
||||
l3d_users_user__ansible_ssh_keys: "{{ lookup('url', 'https://github.com/do1jlr.keys', split_lines=False) }}"
|
||||
l3d_users__create_ansible: true
|
||||
l3d_users__set_ansible_ssh_keys: true
|
||||
l3d_users__ansible_ssh_keys: "{{ lookup('url', 'https://github.com/do1jlr.keys', split_lines=False) }}"
|
||||
submodules_versioncheck: true
|
||||
```
|
||||
|
|
|
@ -26,9 +26,9 @@ l3d_users__local_users: {}
|
|||
# pubkeys: "{{ lookup('url', 'https://github.com/do1jlr.keys', split_lines=False) }}"
|
||||
|
||||
# Create ansible mamagement user
|
||||
l3d_users_user__create_ansible: true
|
||||
l3d_users_user__ansible_user_state: 'present'
|
||||
l3d_users_user__set_ansible_ssh_keys: false
|
||||
l3d_users_user__ansible_ssh_keys: "{{ lookup('url', 'https://github.com/do1jlr.keys', split_lines=False) }}"
|
||||
l3d_users__create_ansible: true
|
||||
l3d_users__ansible_user_state: 'present'
|
||||
l3d_users__set_ansible_ssh_keys: false
|
||||
l3d_users__ansible_ssh_keys: "{{ lookup('url', 'https://github.com/do1jlr.keys', split_lines=False) }}"
|
||||
# run simple versionscheck
|
||||
submodules_versioncheck: false
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
- name: Merge default and locale Users
|
||||
ansible.builtin.set_fact:
|
||||
_l3d_users_user__merged_users: "{{ l3d_users__default_users + l3d_users__local_users }}"
|
||||
_l3d_users__merged_users: "{{ l3d_users__default_users + l3d_users__local_users }}"
|
||||
|
||||
|
||||
- name: Create ansible user with superuser permissions
|
||||
ansible.builtin.include_tasks:
|
||||
file: 'user_ansible.yml'
|
||||
when: l3d_users_user__create_ansible | bool
|
||||
when: l3d_users__create_ansible | bool
|
||||
|
||||
- name: Create Groups and Users
|
||||
ansible.builtin.include_tasks:
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
state: 'present'
|
||||
key: "{{ item.pubkeys | default() }}"
|
||||
exclusive: true
|
||||
loop: "{{ _l3d_users_user__merged_users }}"
|
||||
loop: "{{ _l3d_users__merged_users }}"
|
||||
loop_control:
|
||||
label: "user: ['{{ item.name }}']"
|
||||
when: item.state | default ('present') == 'present'
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
become: true
|
||||
ansible.builtin.group:
|
||||
name: 'ansible'
|
||||
state: "{{ l3d_users_user__ansible_user_state | ternary('present', 'absent') }}"
|
||||
state: "{{ l3d_users__ansible_user_state | ternary('present', 'absent') }}"
|
||||
|
||||
- name: Create user ansible
|
||||
become: true
|
||||
|
@ -12,25 +12,25 @@
|
|||
comment: 'User for ansible to login and perform tasks'
|
||||
shell: '/bin/bash'
|
||||
group: 'ansible'
|
||||
state: "{{ l3d_users_user__ansible_user_state | ternary('present', 'absent') }}"
|
||||
state: "{{ l3d_users__ansible_user_state | ternary('present', 'absent') }}"
|
||||
create_home: true
|
||||
|
||||
- name: Set dedicated SSH keys for User ansible and drop all other keys
|
||||
become: true
|
||||
ansible.posix.authorized_key:
|
||||
user: 'ansible'
|
||||
state: "{{ l3d_users_user__ansible_user_state | ternary('present', 'absent') }}"
|
||||
key: "{{ l3d_users_user__ansible_ssh_keys }}"
|
||||
state: "{{ l3d_users__ansible_user_state | ternary('present', 'absent') }}"
|
||||
key: "{{ l3d_users__ansible_ssh_keys }}"
|
||||
exclusive: true
|
||||
when: l3d_users_user__set_ansible_ssh_keys | bool
|
||||
when: l3d_users__set_ansible_ssh_keys | bool
|
||||
|
||||
- name: Add admin keys to user ansible
|
||||
become: true
|
||||
ansible.posix.authorized_key:
|
||||
user: 'ansible'
|
||||
state: "{{ l3d_users_user__ansible_user_state | ternary('present', 'absent') }}"
|
||||
state: "{{ l3d_users__ansible_user_state | ternary('present', 'absent') }}"
|
||||
key: "{{ item.pubkeys | default() }}"
|
||||
loop: "{{ _l3d_users_user__merged_users }}"
|
||||
loop: "{{ _l3d_users__merged_users }}"
|
||||
when: item.admin | default(false) | bool
|
||||
loop_control:
|
||||
label: "user: ['{{ item.name }}']"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
ansible.builtin.group:
|
||||
name: "{{ item.name }}"
|
||||
state: 'present'
|
||||
loop: "{{ _l3d_users_user__merged_users }}"
|
||||
loop: "{{ _l3d_users__merged_users }}"
|
||||
loop_control:
|
||||
label: "user: ['{{ item.name }}']"
|
||||
when: item.state | default ('present') == 'present'
|
||||
|
@ -19,7 +19,7 @@
|
|||
comment: "User created by ansible"
|
||||
shell: "{{ item.shell | default('/bin/bash') }}"
|
||||
password: "{{ item.password | default() }}"
|
||||
loop: "{{ _l3d_users_user__merged_users }}"
|
||||
loop: "{{ _l3d_users__merged_users }}"
|
||||
loop_control:
|
||||
label: "user: ['{{ item.name }}']"
|
||||
when: item.state | default ('present') == 'present'
|
||||
|
@ -30,7 +30,7 @@
|
|||
name: "{{ item.name }}"
|
||||
state: 'absent'
|
||||
remove: "{{ item.remove | default(false) }}"
|
||||
loop: "{{ _l3d_users_user__merged_users }}"
|
||||
loop: "{{ _l3d_users__merged_users }}"
|
||||
loop_control:
|
||||
label: "user: ['{{ item.name }}']"
|
||||
when: item.state | default ('present') == 'absent' and item.remove | default(false) | bool
|
||||
|
@ -40,7 +40,7 @@
|
|||
ansible.builtin.group:
|
||||
name: "{{ item.name }}"
|
||||
state: 'absent'
|
||||
loop: "{{ _l3d_users_user__merged_users }}"
|
||||
loop: "{{ _l3d_users__merged_users }}"
|
||||
loop_control:
|
||||
label: "user: ['{{ item.name }}']"
|
||||
when: item.state | default ('present') == 'absent' and item.remove | default(false) | bool
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
playbook_version_number: 4
|
||||
playbook_version_number: 5
|
||||
playbook_version_path: 'l3d.users.user.version'
|
||||
|
|
Loading…
Reference in a new issue