{"id":5081,"sha1":"f34f3ae8661a3f2f43309641db5b20c73c338165","playbook":{"id":2975,"items":{"plays":1,"tasks":3,"results":3,"hosts":2,"files":1,"records":0},"arguments":{"version":null,"verbosity":0,"private_key_file":"/home/ssh-gateway/.ssh/id_rsa","remote_user":"root","connection":"ssh","timeout":null,"ssh_common_args":null,"sftp_extra_args":null,"scp_extra_args":null,"ssh_extra_args":null,"ask_pass":false,"connection_password_file":null,"force_handlers":false,"flush_cache":false,"become":false,"become_method":"sudo","become_user":null,"become_ask_pass":false,"become_password_file":null,"tags":["all"],"skip_tags":[],"check":false,"diff":false,"inventory":["/home/ssh-gateway/ansible/kuly/bash-kvm-inventory-dev.sh"],"listhosts":false,"subset":"productive-dragonfly.man-1.solus.stage.town","extra_vars":"Not saved by ARA as configured by 'ignored_arguments'","vault_ids":[],"ask_vault_pass":false,"vault_password_files":[],"forks":20,"module_path":null,"syntax":false,"listtasks":false,"listtags":false,"step":false,"start_at_task":null,"args":["RM10051-get-affected-servers.yaml"]},"labels":[{"id":1,"name":"remote_user:root"},{"id":2,"name":"check:False"},{"id":3,"name":"tags:all"},{"id":188,"name":"subset:productive-dragonfly.man-1.solus.stage.town"}],"started":"2025-05-23T07:48:15.703910+01:00","ended":"2025-05-23T07:48:18.224447+01:00","duration":"00:00:02.520537","name":null,"ansible_version":"2.16.11","client_version":"1.7.2","python_version":"3.10.10","server_version":"1.7.2","status":"completed","path":"/home/ssh-gateway/ansible/kuly/RM10051-get-affected-servers.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Playbook to create a list of affected servers\n  hosts: all\n  gather_facts: false\n  vars:\n    ini_file: /usr/local/psa/admin/conf/panel.ini\n    save_file: /home/ssh-gateway/ansible/kuly/RM10051-get-affected-servers.txt\n    section: \"settings.general\"\n    directive: 'short_open_tag.values[]=\"on\"'\n  tasks:\n    - name: Get server info\n      plesk_info:\n      register: pl\n    - name: Run grep command\n      when: pl.plesk_found\n      ansible.builtin.shell: |\n        set -o pipefail\n        awk '\n        $0 ~ /^\\[{{ section }}\\]/ { in_section=1; next }\n        $0 ~ /^\\[/ && $0 !~ /^\\[{{ section }}\\]/ { in_section=0 }\n        in_section && $0 ~ /^{{ directive | regex_escape }}/ { found=1 }\n        END { exit !found }\n        ' \"{{ ini_file }}\"\n      args:\n        executable: /bin/bash\n      register: directive_check\n      changed_when: false\n      failed_when: false\n    - name: Save hostname if directive is missing\n      when: directive_check.rc != 0\n      ansible.builtin.lineinfile:\n        path: \"{{ save_file }}\"\n        line: \"{{ inventory_hostname }}\"\n        create: true\n        mode: '0644'\n        state: present\n      delegate_to: 127.0.0.1\n","created":"2025-05-23T07:48:15.716040+01:00","updated":"2025-05-23T07:48:15.716068+01:00","path":"/home/ssh-gateway/ansible/kuly/RM10051-get-affected-servers.yaml"}