-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
49 lines (42 loc) · 1.48 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Install TwinCAT on a remote Windows machine.
# Files to upload from {{upload_dir}}, i.e.:
# - TC31-FULL-Setup.3.1.4024.42.exe
# - PsExec.exe (see https://learn.microsoft.com/en-us/sysinternals/downloads/psexec)
---
- name: Install TwinCAT
hosts: all
vars:
user_temp: ''
upload_dir: .install-files/
tc3_version: '3.1.4024.42'
tasks:
- name: Get the temp-directory of current user
ansible.builtin.win_shell: echo %temp%
args:
executable: cmd
register: cmd_output
- name: Set user-temp folder variable
ansible.builtin.set_fact:
user_temp: '{{ cmd_output.stdout | trim }}\~install-files'
- name: Upload installation files
ansible.builtin.win_copy:
src: '{{ upload_dir }}'
dest: '{{ user_temp }}'
directory_mode:
- name: Install TwinCAT3
ansible.builtin.win_psexec:
chdir: '{{ user_temp }}'
executable: '{{ user_temp }}\PsExec.exe'
command: cmd /c START /B /WAIT TC31-FULL-Setup.{{tc3_version}}.exe /clone_wait /s /v"/qr REBOOT=ReallySuppress ALLUSERS=1 /l*v logs\TC31-install.log"
interactive: true
session: 1
system: true
- name: Download TC3 installation log file
ansible.builtin.fetch:
src: '{{ user_temp }}\TC31-install.log'
dest: ./~logs/{{ ansible_hostname }}/TC31-install.log
flat: true
- name: Remove temp-directory
ansible.builtin.win_file:
path: '{{ user_temp }}'
state: absent