Execution
Date 08 Oct 2024 15:57:30 +0100
Duration 00:01:08.01
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.2 / 1.7.2
Python 3.10.10
Summary
177 Hosts
3 Tasks
521 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/projects/ls-bad-bot-blocker/find-ls-bad-bot-blocker-installs.yaml

---
- name: Playbook to find ls-bad-bot-blocker installs
  hosts: all
  gather_facts: false
  tasks:
    - name: On plesk server check if ls-bad-bot-blocker extension is installed
      ansible.builtin.shell: |
        set -o pipefail
        plesk bin extension -l | grep ls-bad-bot-blocker 
      args:
        executable: /bin/bash
      register: result
      failed_when: result.rc != 0 and "command not found" not in result.stderr
      changed_when: false
      ignore_errors: true

    - name: Print message when ls-bad-bot-blocker is  installed
      when: result.rc == 0 or "command not found" in result.stdout
      ansible.builtin.debug:
        msg: "{{inventory_hostname}} ls-bad-bot-blocker installed"

    - name: Print error message when Plesk is not found
      when: result.rc == 127 or "command not found" in result.stderr
      ansible.builtin.debug:
        msg: "Error: plesk command not found, skipping the rest of the steps..."