classroom/roles/facts/tasks/main.yml
2025-08-13 23:54:56 +02:00

26 lines
821 B
YAML

- name: Send valid bash or ps command with different results
raw: |
echo \#\#
register: raw_result
- name: Set shell type
set_fact:
ansible_shell_type: "{% if raw_result['stdout'][-4] == '#' %}sh{% else %}powershell{%endif%}"
- name: Set connection parameters and paths for Windows
become: false
set_fact:
ansible_become_method: runas
ansible_become_flags: ""
ansible_become_user: "{{ windows_user }}"
logon_type: interactive
installers: \\ucilnicesmb.fri1.uni-lj.si\ucilnice_d\install
when: ansible_shell_type == "powershell"
- name: Set connection parameters and paths for Ubuntu
set_fact:
ansible_become_method: sudo
ansible_become_flags: ""
ansible_ssh_extra_args: '-o ForwardX11=yes'
installers: /mnt/ucilnice_d/install
when: ansible_shell_type == "sh"