Hello,
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.
-
The $HOME/.packer.d/plugins
directory, if $HOME
is defined (unix)
-
The %APPDATA%/packer.d/plugins
if %APPDATA%
is defined (windows)
-
The %USERPROFILE%/packer.d/plugins
if %USERPROFILE%
is defined
(windows)
-
The current working directory.
-
The directory defined in the env var PACKER_PLUGIN_PATH
. There can be more
than one directory defined; for example, ~/custom-dir-1:~/custom-dir-2
.
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
~/custom-dir-1/packer-provisioner-foo
or
~/custom-dir-2/packer-provisioner-foo
.
- In simple words…
- Remove any existing instance of the
packer-plugin-lxc
plugin installed earlier.
For example rm ~/.packer.d/plugins/packer-plugin-lxc
- Download the suitable zip from the artifactory and unzip it
-
- Go to the
root
of the unzipped dir and run make dev
OR
- 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 packer init
- 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!
Thanks!
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!
Hey.
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.