Ansible Playbook
Jump to navigation
Jump to search
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: 50 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 -f 10 -i test1.inventory.yaml test2.inventory.yaml playbookUninstallSensuCore.yaml
throttle and serial are options in runbook to limit but not sure how well they work.