Join setup.yml for Windows and Linux

This commit is contained in:
Gašper Fele-Žorž 2025-08-13 16:23:28 +02:00
parent 2fe3a758d5
commit d0ac08e8ba
4 changed files with 68 additions and 7 deletions

View file

@ -1,8 +1,5 @@
Ansible playbooks for deploying classroom computers. Run with something like:
ansible-playbook --user <local admin> -k -K -i inventory.yml setup.py
ansible-playbook --user <AD admin> --ask-pass \
--become-user=<local admin>
--inventory hosts winsetup.yml
ansible-playbook --user <local admin> --ask-pass \
--inventory hosts linsetup.yml
or, for Apple computers:
ansible-playbook --user <local admin> -k -K -i inventory.yml macsetup.py

View file

@ -2,6 +2,7 @@ dependencies:
- role: fri_base
- role: AAHRP-63263
- role: APS1-63279
- role: APS1-63711
- role: ARP1-63545C
- role: BMO-63259
- role: DF-63530
@ -11,6 +12,7 @@ dependencies:
- role: EP-63249
- role: FP-63507
- role: GO-63715
- role: IS-63266
- role: IS-63714
- role: IVZ-63521
- role: KCR-63550
@ -24,17 +26,22 @@ dependencies:
- role: NRG-63553
- role: OBSS-63514
- role: ODV-63204
- role: OIS-63215
- role: OO-63271
- role: OPB-63208
- role: OR-63717
- role: ORS-63218
- role: OS-63217
- role: OS-63709
- role: OS-63741
- role: OUI-63214
- role: P1-63277
- role: P1-63702
- role: P2-63278
- role: P2-63706
- role: PA-63737
- role: PB2-63713
- role: PB-63707
- role: PB2-63713
- role: PJC-63769
- role: PPJ-63220
- role: PS-63261

View file

@ -0,0 +1,35 @@
- name: Try connecting to linux
ping:
register: lin_ping_data
ignore_unreachable: true
ignore_errors: true
- name: Set shell to powershell
set_fact:
ansible_shell_type: powershell
when: lin_ping_data is undefined or lin_ping_data.unreachable is defined
- name: Try connecting to windows
win_ping:
register: win_ping_data
ignore_unreachable: true
ignore_errors: true
- name: Set connection parameters and paths for Windows
become: false
set_fact:
ansible_shell_type: powershell
ansible_connection: ssh
ansible_become_flags: ""
ansible_become_user: "{{ windows_user }}"
logon_type: interactive
installers: \\ucilnicesmb.fri1.uni-lj.si\ucilnice_d\install
when: win_ping_data is defined and win_ping_data.ping is defined
- name: Set connection parameters and paths for Ubuntu
set_fact:
ansible_become_user: root
ansible_become_flags: ""
ansible_ssh_extra_args: '-o ForwardX11=yes'
installers: /mnt/ucilnice_d/install
when: lin_ping_data is defined and lin_ping_data.ping is defined

22
setup.yml Normal file
View file

@ -0,0 +1,22 @@
- name: Gather facts / setup connection
hosts: '*'
gather_facts: false
become: false
vars_files:
- vars/credentials.yml
roles:
- facts
- name: Install software
hosts: '*'
become: true
become_method: runas
vars_files:
- vars/software_keys.yml
roles:
- all_classes
# - matplotlib
# - nodejs
# - qcadesigner-e
# - fri_base
# - powerdesigner