Execution
Date 08 Apr 2025 09:10:45 +0100
Duration 00:00:02.55
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
1 Hosts
3 Tasks
3 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/RM9972-2.yaml

---
- name: Playbook to check
  hosts: all
  gather_facts: false
  vars:
    sqlite_command: "sqlite3 /usr/local/psa/var/modules/monitoring/monitoring.sqlite3 \"select * from params where name = 'cloud_service_api_key'\""
    api_key_to_check: "15c642d7e43747cbe4d1f8062d8747e547c111d0aaa3c229e68f1179a61fbcaa"
  tasks:
    - name: Gather info
      plesk_info:
      register: plsk
    - name: Run command on plesk server
      when: plsk.plesk_found
      ansible.builtin.shell: |
        set -o pipefail
        hostname -f
        if {{ sqlite_command }} | grep -q {{ api_key_to_check }}; then
        echo "API Key {{ api_key_to_check }} found in database.";
        else
        echo "API Key {{ api_key_to_check }} NOT found in database.";
        fi;
        agent360 --info | grep "Server:" | awk '{ print $2 }'
      args:
        executable: /bin/bash
      register: result
      changed_when: false
      failed_when: false
    - name: Check for the specific string and display if not found
      ansible.builtin.debug:
        var: result.stdout_lines