Fix invalid variable naming for user role

According to the linter variables used within rules should start with
the role's prefix.
This commit is contained in:
Thomas Kleinendorst 2024-04-13 13:54:49 +02:00
parent 6c0425418e
commit 22376928e2
3 changed files with 8 additions and 8 deletions

View file

@ -8,8 +8,8 @@
ansible.builtin.include_role:
name: user
vars:
username: "{{ actual_user }}"
password: "{{ actual_password }}"
user_username: "{{ actual_user }}"
user_password: "{{ actual_password }}"
- name: Create a directory for holding actual's (volume) data
become: true
become_user: "{{ actual_user }}"

View file

@ -3,8 +3,8 @@
ansible.builtin.include_role:
name: user
vars:
username: "{{ cloudflare_ddns_user }}"
password: "{{ cloudflare_ddns_user_password }}"
user_username: "{{ cloudflare_ddns_user }}"
user_password: "{{ cloudflare_ddns_user_password }}"
- name: Install Python dependencies # noqa: package-latest
become: true
ansible.builtin.apt:

View file

@ -7,13 +7,13 @@
append: true
groups:
- users
name: "{{ username }}"
name: "{{ user_username }}"
# Salt is necessary, see: https://stackoverflow.com/questions/56869949/ansible-user-module-always-shows-changed
password: "{{ password | password_hash('sha512', password_salt) }}"
when: username is not undefined # Skip when no user is provided, we'll asume we're targetting the Ansible user.
password: "{{ user_password | password_hash('sha512', password_salt) }}"
when: user_username is not undefined # Skip when no user is provided, we'll asume we're targetting the Ansible user.
- name: Set fact for defining the user which should run the next modules
ansible.builtin.set_fact:
target_user: "{{ ansible_facts['user_id'] if username is undefined else username }}"
target_user: "{{ ansible_facts['user_id'] if user_username is undefined else user_username }}"
- name: Ensuring ZSH is installed # noqa: package-latest
become: true
ansible.builtin.apt: