Skip to content

Commit

Permalink
Added user check
Browse files Browse the repository at this point in the history
  • Loading branch information
usma0118 committed Oct 31, 2024
1 parent d00925d commit 942b9ea
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions playbooks/alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
gather_facts: true
any_errors_fatal: true
vars:
user: "{{ ansible_user | default(lookup('env', 'USER') | 'vscode') }}"
user: "{{ ansible_user | default(lookup('env', 'USER') | default('vscode')) }}"

pre_tasks:
- name: Ensure user variable is set

Check failure on line 10 in playbooks/alpine.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

fqcn[action-core]

Use FQCN for builtin module actions (assert).
assert:
that:
- user is defined
fail_msg: "User variable could not be determined."
- name: Print the determined ansible user

Check failure on line 15 in playbooks/alpine.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

fqcn[action-core]

Use FQCN for builtin module actions (debug).
debug:
msg: "Ansible user is {{ user }}"
tasks:
- name: Print the determined ansible user
debug:
msg: "user is {{ user }}, {{ lookup('env', 'USER') }}"
# roles:
# - role: common
# common_user: "{{ user }}"
# - role: ohMyZSH
# ohmyzsh_user: "{{ user }}"

roles:
- role: common
common_user: "{{ user }}"
- role: ohMyZSH
ohmyzsh_user: "{{ user }}"

Check failure on line 23 in playbooks/alpine.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

var-naming[no-role-prefix]

Variables names from within roles should use ohMyZSH_ as a prefix. (vars: ohmyzsh_user)

0 comments on commit 942b9ea

Please sign in to comment.