Packer with Docker and Ansible

Hi,

is it possible to firstly pull docker image, untar it inside /tmp/test,
run ansible plays remotely in that directory and at end export /tmp/tar as a new image?
I was trying to do that, but it did not work:

{
“builders”: [
{
“type”: “docker”,
“image”: “ubuntu:20.04”,
“export_path”: “/tmp/test/test.tar”
}
],
“provisioners”: [
{
“type”: “ansible”,
“playbook_file”: “./test.yml”
}
],
“post-processors”: [
[
{
“type”: “docker-import”,
“repository”: “image_name”
}
]
]
}

It does not work because ansible runs before the image is exported into .tar - inside test.yml playbook is a play where I untar that image. Also I am using ansible instead of ansible-local, because when I rerun ansible, I want to only run plays that need to be changed on localhost, not all running again on that docker provisionary container created by packer.