hashicorp / hashicorp/packer-plugin-azure

Let user handle mounts (Azure chroot)

Open
#67 0 comments 0 reactions 0 assignees View on GitHub
builder/azure enhancement
Dominant language
Go
Stars
63
Forks
103
PR merge metrics
No merged PRs in 30d

Description

_This issue was originally opened by @backerman as hashicorp/packer#9657. It was migrated here as a result of the [Packer plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737). The original body of the issue is below._


Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.

#### Community Note

Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

#### Description

The Azure chroot builder should allow the user to handle all mounting of filesystems with `pre_mount_commands`.

#### Use Case(s)

I'm building FreeBSD images with ZFS root in Azure (Ubuntu or another Linux distribution should have the same issue and solution). The Azure chroot builder has no option to *not* mount the root filesystem, which isn't going to work because ZFS doesn't use the `mount` command that way.

#### Potential configuration

```json
{
"variables": {
},
"builders": [
{
"type": "azure-chroot",
"from_scratch": true,
"image_resource_id": "/subscriptions/{{vm `subscription_id`}}/resourceGroups/{{vm `resource_group`}}/providers/Microsoft.Compute/images/freebsd-{{timestamp}}",
"os_disk_size_gb": 8,
"os_disk_storage_account_type": "Premium_LRS",
"os_type": "Linux",
"mount_root": false,
"mount_path": "/tmp/packer-chroot",
"pre_mount_commands": [
"mkdir /usr/freebsd-dist",
"env BSDINSTALL_DISTSITE=https://download.freebsd.org/ftp/releases/amd64/12.1-RELEASE/ DISTRIBUTIONS=\"base.txz doc.txz kernel.txz src.txz\" bsdinstall distfetch",
"bsdinstall script bsdinstall",
"zpool import -R /tmp/packer-chroot zroot"
],
"post_mount_commands": [
"zpool export zroot"
]
}
],
"provisioners": [
{
"inline": [
"env ASSUME_ALWAYS_YES=YES pkg bootstrap",
"/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"
],
"inline_shebang": "/bin/sh -x",
"type": "shell"
}
]
}
```

#### Potential References

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.