Ansible and Proxmox without API

jessefmoore

New Member
Mar 20, 2022
2
0
1
48
Hello!
I'm trying to use Ansible the normal way but it seems like Proxmox won't let me unless I use the Ansible Module for Promox and use the api.

So its this way or nothing at all is how I see it. https://docs.ansible.com/ansible/2.9/modules/proxmox_module.html#examples

I would like to use root and a regular password to access Proxmox with Ansible to then run my own Ansible things not in the above doc.

Is this the case?

Thank you for your help!
Happy Holidays ahead!
 
Hi,
you can use the password that was set on installation to log in as root via ssh, which is what ansible uses under the hood.
For more security and convenience, I would strongly suggest switching to ssh keys.

On the system itself, you could call the cli tools provided by proxmox, from your ansible script.
The proxmox documentation [0] usually gives an example on how to do what you want to archive via the cli, or you can consult the manpages for an explanation of what a command does.


[0] https://pve.proxmox.com/pve-docs/
 
Hi,
Thanks for the input.
I added the ssh key and service ssh restart


If others are curious. This was my ansible playbook.

[prox]
192.168.0.12

[prox:vars]
ansible_user=root
ansible_connection=ssh
ansible_ssh_common_args="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
ansible_ssh_private_key_file=~/.ssh/cyber

Thank you! I am able to access ansible via my sshkey and run normal Ansible playbooks. :)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!