From 267848314951cb8df11fe76ddad6100b51bd5b6b Mon Sep 17 00:00:00 2001 From: fencl Date: Sun, 5 Oct 2025 08:47:14 +0200 Subject: [PATCH] Refactor miniplay.yml: enhance documentation for command execution parameters and update task structure for clarity and functionality. --- nextcloud/miniplay.yml | 54 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/nextcloud/miniplay.yml b/nextcloud/miniplay.yml index 0bdfaee..a7ea77e 100644 --- a/nextcloud/miniplay.yml +++ b/nextcloud/miniplay.yml @@ -1,8 +1,50 @@ ---- -- name: "SSH ping through jump host" - hosts: nextcloud_host +# """ +# Run the command and check the response. +# +# :parameter command: The command to be executed. +# :parameter add_command: Whether to include the command in the database values. +# :parameter add_response: Whether to include the response in the database values. +# :parameter measurement: The measurement index for the command. +# :parameter measure_retries: The number of retries for measurement in case of failure. +# :parameter check_port: Whether to check the port before sending the command. +# :parameter response_equals: The expected response string to compare against. +# :parameter response_length: The expected length or format of the response. +# :parameter send_skipped: Whether to mark the test as skipped without execution. +# :parameter no_response: Whether to expect no response from the command. +# :parameter expect_patch_id_decimal: The expected patch ID in decimal format for validation. +# :parameter response_equals_match: The expected response string to match against. +# :return: RunResultType +# """ + +- name: Get VM hostname via Proxmox jump + hosts: proxmox gather_facts: false - become: false + become: true + become_user: root + become_method: sudo + + vars: + vm_ip: "192.168.69.253" + vm_user: "howard" + vm_pass: "Papadopolus0" + tasks: - - name: ping - ansible.builtin.ping: \ No newline at end of file + - name: Ensure sshpass is installed (for password-based SSH) + ansible.builtin.apt: + name: sshpass + state: present + update_cache: yes + + - name: Get hostname from VM + ansible.builtin.command: > + bash -lc "sshpass -p '{{ vm_pass }}' + ssh -o StrictHostKeyChecking=no + -o ConnectTimeout=10 + {{ vm_user }}@{{ vm_ip }} hostname" + register: vm_hostname + changed_when: false + failed_when: vm_hostname.rc != 0 + + - name: Print VM hostname + ansible.builtin.debug: + msg: "VM hostname: {{ vm_hostname.stdout | default('N/A') }}" \ No newline at end of file