From 48231d5b53cbff7f8132fa846e36c0c2051ed910 Mon Sep 17 00:00:00 2001 From: L3D Date: Wed, 14 Feb 2024 21:25:00 +0100 Subject: [PATCH] Update variable names --- roles/user/README.md | 14 +++++++------- roles/user/defaults/main.yml | 8 ++++---- roles/user/tasks/main.yml | 4 ++-- roles/user/tasks/pubkeys.yml | 2 +- roles/user/tasks/user_ansible.yml | 14 +++++++------- roles/user/tasks/users.yml | 8 ++++---- roles/user/vars/main.yml | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/roles/user/README.md b/roles/user/README.md index d3bbe7b..0dee46f 100644 --- a/roles/user/README.md +++ b/roles/user/README.md @@ -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 ``` diff --git a/roles/user/defaults/main.yml b/roles/user/defaults/main.yml index df80f77..1a49442 100644 --- a/roles/user/defaults/main.yml +++ b/roles/user/defaults/main.yml @@ -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 diff --git a/roles/user/tasks/main.yml b/roles/user/tasks/main.yml index 8a6921e..1f207cf 100644 --- a/roles/user/tasks/main.yml +++ b/roles/user/tasks/main.yml @@ -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: diff --git a/roles/user/tasks/pubkeys.yml b/roles/user/tasks/pubkeys.yml index 29667ec..78e174a 100644 --- a/roles/user/tasks/pubkeys.yml +++ b/roles/user/tasks/pubkeys.yml @@ -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' diff --git a/roles/user/tasks/user_ansible.yml b/roles/user/tasks/user_ansible.yml index 4abea6e..1ec5fdc 100644 --- a/roles/user/tasks/user_ansible.yml +++ b/roles/user/tasks/user_ansible.yml @@ -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 }}']" diff --git a/roles/user/tasks/users.yml b/roles/user/tasks/users.yml index 710eac4..c39b23c 100644 --- a/roles/user/tasks/users.yml +++ b/roles/user/tasks/users.yml @@ -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 diff --git a/roles/user/vars/main.yml b/roles/user/vars/main.yml index c48bd4d..554e7e0 100644 --- a/roles/user/vars/main.yml +++ b/roles/user/vars/main.yml @@ -1,3 +1,3 @@ --- -playbook_version_number: 4 +playbook_version_number: 5 playbook_version_path: 'l3d.users.user.version'