-
Notifications
You must be signed in to change notification settings - Fork 1
/
100.9_playbook-uninstall-windows-agent.yaml
37 lines (36 loc) · 1.38 KB
/
100.9_playbook-uninstall-windows-agent.yaml
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
# Example Playbok to deploy agents
- name: Deploy App Agent
hosts: windows
vars_files:
- ./vars/main.yml
- ./vars/agents_vars.yaml
- "{{ agent_src }}/agents.yaml"
vars:
agent_src: /tmp
tasks:
- name: Copy agent to {{ ansible_fqdn }}
ansible.windows.win_copy:
src: "{{ agent_src }}/{{ app_agent }}"
dest: C:/Temp/
- name: Unzip Agents
community.windows.win_unzip:
src: "C:/Temp/{{ app_agent | basename }}"
dest: C:/swdist
register: unzip
- name: Find files in path based on regex pattern
ansible.windows.win_find:
paths: c:/swdist/ntx64, c:/swdist/win_x64
patterns: "*-{{ agent_release }}.exe"
register: find_file
- name: "Remove with fsagent {{ find_file.files[0].path }} on {{ ansible_fqdn }}"
ansible.windows.win_command:
cmd: '"{{ find_file.files[0].path }}" /s /uninstall UnInstallBBBWT="1" PPDMHostName="{{ ppdm_fqdn }}" UnInstallPPDMAgent="1"'
when: app_agent == fs_agent_windows
- name: "Remove with msappagent {{ find_file.files[0].path }} on {{ ansible_fqdn }}"
ansible.windows.win_command:
cmd: '"{{ find_file.files[0].path }}" /q /uninstall PPDMHostname={{ ppdm_fqdn }} UninstallAgentService="1"'
when: app_agent == msapp_agent_windows
# - name: remove DPSAPPS directory
# ansible.windows.win_file:
# path: c:/Program Files/DPSAPPS/
# state: absent