Execution
Date 18 Dec 2025 15:15:16 +0000
Duration 00:00:05.33
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.3 / 1.7.3
Python 3.10.10
Summary
1 Hosts
4 Tasks
4 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/RM10236-check-botstopper-service.yaml

---
- name: Verify BotStopper service is stopped when panel.ini flag is false
  hosts: all
  gather_facts: false
  vars:
    svc: "techaro-botstopper@main.service"
  tasks:
    - name: Get server info
      plesk_info:
      register: p

    - name: Read BotStopper state from panel.ini
      when:
        - p.plesk_found
        - p.botstopper_found
      ansible.builtin.shell: |
        set -o pipefail
        grep -i '^botstopperEnabled' /usr/local/psa/admin/conf/panel.ini | awk '{print $3}'
      register: botstopper_state
      changed_when: false
      failed_when: false

    - name: Check systemd service status
      ansible.builtin.systemd:
        name: "{{ svc }}"
      register: svc_status
      when: botstopper_state.stdout | trim == 'false'

    - name: Assert service is inactive (stopped) and not enabled
      ansible.builtin.assert:
        that:
          - svc_status.status.ActiveState == "inactive"
          - svc_status.status.SubState     == "dead"
          - svc_status.status.LoadState    != "loaded" or svc_status.status.LoadState == "loaded"   # unit file is read
          - svc_status.status.LoadState    == "disabled"   # not enabled for auto-start
        fail_msg: |
          Service {{ svc }} is NOT stopped/disabled even though
          botstopperEnabled=false in panel.ini.
          Current state: {{ svc_status.status.ActiveState }}/{{ svc_status.status.SubState }}  LoadState={{ svc_status.status.LoadState }}
      when: botstopper_state.stdout | trim == 'false'