Difference between revisions of "Ansible Playbook"
Jump to navigation
Jump to search
(Created page with "Here is an example of removing old service no longer used on windows ## Set your vars vars.yaml ``` ansible_user: '' ansible_password: '' ansible_connection: winrm ansible_po...") |
|||
Line 33: | Line 33: | ||
throttle: 15 | throttle: 15 | ||
ansible.builtin.script: ./uninstallSensuCore.ps1 | ansible.builtin.script: ./uninstallSensuCore.ps1 | ||
− | when: result is not failed and ansible_facts['os_family'] == "Windows" | + | when: result is not failed |
+ | # If facts #when: result is not failed and ansible_facts['os_family'] == "Windows" | ||
``` | ``` | ||
Revision as of 01:27, 5 August 2021
Here is an example of removing old service no longer used on windows
Set your vars
vars.yaml
ansible_user: '' ansible_password: '' ansible_connection: winrm ansible_port: 5985 ansible_winrm_scheme: http # not recommended ansible_winrm_transport: ntlm ansible_winrm_server_cert_validation: ignore # not recommended
playbookUninstallSensuCore.yaml
--- - name: Checking Services on Windows # connection: ansible.netcommon.network_cli gather_facts: false hosts: all vars_files: - vars.yaml tasks: - name: Sensucore service sensu-client exists on host win_service: name: sensu-client register: result failed_when: result['exists'] == false - name: Uninstall SensuCore throttle: 15 ansible.builtin.script: ./uninstallSensuCore.ps1 when: result is not failed # If facts #when: result is not failed and ansible_facts['os_family'] == "Windows"
test.inventory.yaml
all: hosts: myhost.example.com:
/usr/bin/ansible-playbook -i test.inventory.yaml playbookUninstallSensuCore.yaml