Difference between revisions of "Ansible Playbook"
Jump to navigation
Jump to search
| Line 31: | Line 31: | ||
failed_when: result['exists'] == false | failed_when: result['exists'] == false | ||
- name: Uninstall SensuCore | - name: Uninstall SensuCore | ||
| − | throttle: | + | throttle: 50 |
ansible.builtin.script: ./uninstallSensuCore.ps1 | ansible.builtin.script: ./uninstallSensuCore.ps1 | ||
when: result is not failed | when: result is not failed | ||
| Line 47: | Line 47: | ||
/usr/bin/ansible-playbook -f 10 -i test.inventory.yaml playbookUninstallSensuCore.yaml | /usr/bin/ansible-playbook -f 10 -i test.inventory.yaml playbookUninstallSensuCore.yaml | ||
``` | ``` | ||
| + | |||
| + | throttle and serial are options in runbook to limit but not sure how well they work. | ||
Revision as of 01:48, 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: 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 test.inventory.yaml playbookUninstallSensuCore.yaml
throttle and serial are options in runbook to limit but not sure how well they work.