# Controlling with Ansible packer

**URL:** <https://forum.ansible.com/t/controlling-with-ansible-packer/43233>\
**Category:** Get Help\
**Tags:** proxmox, project, redhat\
**Created:** [June 8, 2025, 12:19pm UTC](https://forum.ansible.com/t/controlling-with-ansible-packer/43233 "2025-06-08T12:19:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![willywortel-24](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/willywortel-24/32/7224_2.png) [@willywortel-24](https://forum.ansible.com/u/willywortel-24)\
**Post date:** [June 8, 2025, 12:19pm UTC](https://forum.ansible.com/t/controlling-with-ansible-packer/43233/1 "2025-06-08T12:19:15Z")

</div>

I wanted to tell ansible with this script that the packer has to activate to generate a packer image file that then talks to proxmox via an API. Below is the ansible script I’m trying with:

- name: Check and run Packer  
hosts: purple  
tasks:

- name: Check if test.pkr.hcl exists  
stat:  
path: /home/oxana/packer/project/test.pkr.hcl  
register: file\_status

- name: Run Packer build if file exists  
command: packer build /home/oxana/packer/project/test.pkr.hcl  
when: file\_status.stat.exists

---

<div class="post-metadata">

**Author:** ![russoz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/russoz/32/127_2.png) [@russoz](https://forum.ansible.com/u/russoz)\
**Post date:** [June 15, 2025, 10:21pm UTC](https://forum.ansible.com/t/controlling-with-ansible-packer/43233/2 "2025-06-15T22:21:49Z")

</div>

Hi @willywortel-24 welcome to he bandwagon!

It is not very clear what you’re after with this. If you need help with `packer` I suggest you seek out for communities related to that tool.

As for the Ansible part, I would suggest you post this on the “Get Help” category, if that’s what you’re after. Depending on what you are trying to do, this code is good, or it could be improved upon. Have you run it? Have you tested? Is there anything going wrong? All those things are important when you trying to get some help from the community.

Cheers
