We want to use Packer to build AMIs in AWS, but the environment is closed for security reason. So Packer won’t have any access to the internet. The
packer init steps fails because it tries to download the necessary plugins from the internet and that fails.
We do use Artifactory, which we use to provide access to artifacts available on the internet for other tools. Is it possible to direct Packer to download plugins from Artifactory? I searched on Packer’s official documentation, but I couldn’t find anything on that subject.
Thank you very much for your help
Hey @ftriboix ,
Steps to install the binaries manually:
The easiest way to manually install a plugin is to name it correctly, then place it in the proper directory. To name a plugin correctly, make sure the binary is named
packer-plugin-NAME. For example,
packer-plugin-lxc for a “plugin”
binary named “lxc”. This binary will make one or more components available to use.
Once the plugin is named properly, Packer automatically discovers plugins in the following directories in the given order. If a conflicting plugin is found later, it will take precedence over the one found earlier.
The directory where
packer is, or the executable directory.
$HOME/.packer.d/plugins directory, if
$HOME is defined (unix)
%APPDATA% is defined (windows)
%USERPROFILE% is defined
The current working directory.
The directory defined in the env var
PACKER_PLUGIN_PATH. There can be more
than one directory defined; for example,
Separate directories in the PATH string using a colon (
:) on posix systems and
a semicolon (
;) on windows systems. The above example path would be able to
find a provisioner named
packer-provisioner-foo in either
- In simple words…
- Remove any existing instance of the
packer-plugin-lxc plugin installed earlier.
- Download the suitable zip from the artifactory and unzip it
- Go to the
root of the unzipped dir and run
- Rename the unzipped dir and move it to the appropriate location as mentioned above
- Remove the
lxc part from the
packer block in the template because now you do not need to install it using
- Run the build
You can find these steps in
manually section in the Install Plugins doc.
Please feel free to reach out if you need help!
Hi @devashish-patel ,
Thanks a lot for pointing this out, that should indeed work for us. Could you please let me know where I can download the plugin binaries, at least the Hashicorp ones? I couldn’t find that information in the documentation…
Thank you very much!
Packer plugins are separate, standalone applications that perform tasks during each build.
You do not need to install the builder, provisioner, or post-processor components that ship with the Packer binary. Packer automatically knows how to find and launch these built-in plugins.
This page explains how to install custom external plugins. Refer to External Plugins for a list of available plugins and their documentation.