aboutsummaryrefslogtreecommitdiffstats
path: root/roles/_workstation/env/tasks
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2021-03-01 15:46:23 +0100
committerbinary <me@rgoncalves.se>2021-03-01 15:46:23 +0100
commita29fa5af783977e298777d5a870fc4191466371a (patch)
treef8e9bf5ae86170b441dffde43caa7430efe72575 /roles/_workstation/env/tasks
parent637d9584c27edd835c24f30eed4ab7d8b4189925 (diff)
downloadinfrastructure-a29fa5af783977e298777d5a870fc4191466371a.tar.gz
Add env role and meta tasks for workstation playbook
Diffstat (limited to 'roles/_workstation/env/tasks')
-rw-r--r--roles/_workstation/env/tasks/main.yml24
1 files changed, 24 insertions, 0 deletions
diff --git a/roles/_workstation/env/tasks/main.yml b/roles/_workstation/env/tasks/main.yml
new file mode 100644
index 0000000..35342df
--- /dev/null
+++ b/roles/_workstation/env/tasks/main.yml
@@ -0,0 +1,24 @@
+
+# _workstation/env ~~ roles/_workstation/env/tasks/main.yml
+# useful env. variables for workstation
+
+---
+
+- name: retrieve BECOME method
+ stat: path=/usr/bin/doas
+ register: _workstation_env_become
+
+- name: retrieve original user
+ shell: logname
+ register: _workstation_env_user
+
+- name: register username original user
+ set_fact:
+ _workstation_env_user: "{{ _workstation_env_user.stdout }}"
+
+- name: retrieve host facts
+ set_fact:
+ #ansible_become_method: "{{ 'doas' if _workstation_env_become.stat.exists else 'sudo' }}"
+ ansible_become_method: "su"
+ ansible_become_user: "{{ _workstation_env_user }}"
+
remember that computers suck.