Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
993 changes: 993 additions & 0 deletions plugins/connection/proxmox_qm_remote.py

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions tests/integration/targets/connection_proxmox_qm_remote/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2025 Nils Stein (@mietzen) <[email protected]>
# Copyright (c) 2025 Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

azp/posix/3
destructive
needs/root
needs/target/connection
skip/docker
skip/alpine
skip/macos
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
# Copyright (c) 2025 Nils Stein (@mietzen) <[email protected]>
# Copyright (c) 2025 Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

- hosts: localhost
gather_facts: true
serial: 1
tasks:
- name: Copy qm mock
copy:
src: files/qm
dest: /usr/sbin/qm
mode: '0755'
- name: Install paramiko
pip:
name: "paramiko>=3.0.0"
33 changes: 33 additions & 0 deletions tests/integration/targets/connection_proxmox_qm_remote/files/qm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Copyright (c) 2025 Nils Stein (@mietzen) <[email protected]>
# Copyright (c) 2025 Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

# Shell script to mock proxmox qm behaviour

>&2 echo "[DEBUG] INPUT: $@"

pwd="$(pwd)"

# Get quoted parts and restore quotes
declare -a cmd=()
for arg in "$@"; do
if [[ $arg =~ [[:space:]] ]]; then
arg="'$arg'"
fi
cmd+=("$arg")
done

cmd="${cmd[@]:3}"
vmid="${@:2:1}"
>&2 echo "[INFO] MOCKING: qm ${@:1:3} ${cmd}"
tmp_dir="/tmp/ansible-remote/proxmox_qm_remote/integration_test/vm_${vmid}"
mkdir -p "$tmp_dir"
>&2 echo "[INFO] PWD: $tmp_dir"
>&2 echo "[INFO] CMD: ${cmd}"
cd "$tmp_dir"

eval "${cmd}"

cd "$pwd"
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

- hosts: "{{ target_hosts }}"
gather_facts: false
serial: 1
tasks:
- name: create file without content
copy:
content: ""
dest: "{{ remote_tmp }}/test_empty.txt"
force: no
mode: '0644'

- name: assert file without content exists
stat:
path: "{{ remote_tmp }}/test_empty.txt"
register: empty_file_stat

- name: verify file without content exists
assert:
that:
- empty_file_stat.stat.exists
fail_msg: "The file {{ remote_tmp }}/test_empty.txt does not exist."

- name: verify file without content is empty
assert:
that:
- empty_file_stat.stat.size == 0
fail_msg: "The file {{ remote_tmp }}/test_empty.txt is not empty."
19 changes: 19 additions & 0 deletions tests/integration/targets/connection_proxmox_qm_remote/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Copyright (c) 2025 Nils Stein (@mietzen) <[email protected]>
# Copyright (c) 2025 Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

set -eux

ANSIBLE_ROLES_PATH=../ \
ansible-playbook dependencies.yml -v "$@"

./test.sh "$@"

ansible-playbook plugin-specific-tests.yml -i "./test_connection.inventory" \
-e target_hosts="proxmox_qm_remote" \
-e action_prefix= \
-e local_tmp=/tmp/ansible-local \
-e remote_tmp=/tmp/ansible-remote \
"$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2025 Nils Stein (@mietzen) <[email protected]>
# Copyright (c) 2025 Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

[proxmox_qm_remote]
proxmox_qm_remote-pipelining ansible_ssh_pipelining=true
proxmox_qm_remote-no-pipelining ansible_ssh_pipelining=false
[proxmox_qm_remote:vars]
ansible_host=localhost
ansible_user=root
ansible_python_interpreter="{{ ansible_playbook_python }}"
ansible_connection=community.proxmox.proxmox_qm_remote
proxmox_vmid=123
Loading