-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom 'script' is not persisted on Packer and Vagrant doesn´t display them when using Vagrantfile #192
Comments
It looks like you just need to add `script/devops_tools.sh` to the scripts section of your shell provisioner in your `ubuntu.json`. There's no easy way for packer to pick up new scripts automatically, as unless something changed recently, the shell provisioners don't take wildcards. (It's doable, but it requires shenanigans with the floppy and transferring scripts over to the packer side).
So the easiest wayt to get the desired behaviour should be to change the `shell provisioner` block in `ubuntu.json` like so:
```
"provisoners": [ {
"environment_vars": [
<same as before>
],
"execute_command": "<same as before>",
"scripts": [
"script/desktop.sh",
<same stuff as before>,
"script/cleanup.sh",
"script/devops_tools.sh"
^^^^^^^^^^^^^^^^^^^^^^^^^ <---- add "script/devops_tools.sh" to the script list
],
"type": "shell",
"expect_disconnect": "true"
} ],
```
… On Aug 1, 2020, at 8:39 AM, Jon Udaondo ***@***.***> wrote:
Hello,
Thank for this project.
I have used this code to make an own custom devops environment (https://github.com/joudaon/vagrant-devops <https://github.com/joudaon/vagrant-devops>).
On the script folder I have added an script devops_tools.sh to install custom software (please see the script on: https://github.com/joudaon/vagrant-devops/blob/master/vagrant/provision/devops_tools.sh <https://github.com/joudaon/vagrant-devops/blob/master/vagrant/provision/devops_tools.sh>). And of course this script has been added to ubuntu.json file.
I want all these programs to be installed on the "box" packer build so that when I create a new Vagrantfile the software is already installed and I don´t have to provision it.
The things is that when I create a new Vagrantfile and use that box, Ubuntu Destkop doesn´t display that installed software and that's why I have to provision devops_tools.sh on the Vagrant side and not on the Packer.
Any clue why this is happening?
Thank you.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#192>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC7FMAYM67YZUX6JBJ4U5XLR6QZJRANCNFSM4PR2V4RQ>.
|
Hi @boxcutter-robot I have tried that and didn´t work. The But when running, Well, I placed Thank you. |
As long as you verify the script is being run (which you can add some "echo" statements to verify that), then you'll need to troubleshoot it a little further.
One possibility is that the cleanup script is undoing something. So you might want to try commenting that out to see if that is a factor.
Another possibility is that you're pointing at the wrong box, your Vagrantfile might not actually be using the box that you built, so you might want to check that as well. Make sure that what is registered in vagrant and what you are using are actually what was built.
All I can think of for now.
… On Aug 1, 2020, at 9:53 AM, Jon Udaondo ***@***.***> wrote:
Hi @boxcutter-robot <https://github.com/boxcutter-robot> I have tried that and didn´t work.
The devops_tools.sh script is run and packer builds box file for vagrant.
But when running, vagrant up none of the tools of that script are present.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#192 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC7FMA5O6T333POEIFDVG6DR6RCA7ANCNFSM4PR2V4RQ>.
|
I will try running Thank you. |
I tried running I don´t know how to handle this, it should work and install those programs and they should be available on the |
Hello,
Thank for this project.
I have used this code to make an own custom devops environment (https://github.com/joudaon/vagrant-devops).
On the
script
folder I have added an scriptdevops_tools.sh
to install custom software (please see the script on: https://github.com/joudaon/vagrant-devops/blob/master/vagrant/provision/devops_tools.sh). And of course this script has been added toubuntu.json
file.I want all these programs to be installed on the "box" packer build so that when I create a new
Vagrantfile
the software is already installed and I don´t have to provision it.The thing is that when I create a new Vagrantfile and use that box, Ubuntu Destkop doesn´t display that installed software and that's why I have to provision
devops_tools.sh
on the Vagrant side and not on the Packer.Any clue why this is happening?
Thank you.
The text was updated successfully, but these errors were encountered: