gem#Ubuntu:~/work/source$ ls
package.box pretty-simple-redismonitor sonar Vagrantfile VirtualBox-4.3.2
gem#Ubuntu:~/work/source$ vagrant package --vagrantfile sonar
/home/gem/work/source/Vagrantfile:5: warning: already initialized constant
VAGRANTFILE_API_VERSION
[default] Clearing any previously set forwarded ports...
[default] Creating temporary directory for export...
[default] Exporting VM...
[default] Compressing package to: /home/gem/work/source/package.box
[default] Packaging additional file: sonar
gem#Ubuntu:~/work/source$ vagrant package --vagrantfile pretty-simple-redismonitor
/home/gem/work/source/Vagrantfile:5: warning: already initialized constant
VAGRANTFILE_API_VERSION
[default] Clearing any previously set forwarded ports...
[default] Creating temporary directory for export...
[default] Exporting VM...
The specified file to save the package as already exists.
Please remove this file or specify a different file name for outputting.
I am unable to add another item in the package. Actually I am new to vagrant, please let me know how to add and to share these packages with my team members.
If you want to add additional files to the packaged box you should use the --include option.
Here is the complete usage banner:
Usage: vagrant package [vm-name] [--base name] [--output name.box]
[--include one,two,three] [--vagrantfile file]
--base NAME Name of a VM in virtualbox to package as a base box
--output NAME Name of the file to output
--include x,y,z Additional files to package with the box.
--vagrantfile file Vagrantfile to package with the box.
-h, --help Print this help
Related
I mounted lb3 into lb4 app as documented but now i can not use lb cli and getting the following error: "Warning: Found no data sources to attach model. There will be no data-access methods available until datasources are attached.".
It's because the cli looking for the json file in the root directory and not in the lb3app directory as advised in the upper doc.
how can i tell the CLI that the configuration files are inside the sub dir lb3app instead of the parent directory newlb4app?
tried to execute the lb from newlb4app and from the sub dir lb3app. no success.
I removed the file .yo-rc.json and it solved the problem. Seems thatthe CLI looking for that file on parents directories and if exists it set that location as the project root dir.
When i deleted the file, the parent directory is now the current directory.
I am trying to COPY JAVA binaries from an already existing image over to new image using multistage dockerfile.
After the image is built, I do see all the files in the new image but when I execute JAVA, it gives me no such file or directory.
FROM quay.io/<private-repo>/node:12.8.0-slim
COPY --from=quay.io/<private-repo>/openjdk:8u212-jre-alpine /usr/lib/jvm/java-1.8-openjdk/ /usr/lib/jvm/java-8-openjdk-amd64/
# Setup JAVA_HOME, this is useful for docker commandline
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
RUN export JAVA_HOME
ENV PATH $PATH:$JAVA_HOME/bin
RUN export JAVA_HOME - will export the environment file only for the specific run instance. If you are logging in using docker exec and verifying the JAVA_HOME value. It will not exists.
Similarly ENV PATH $PATH:$JAVA_HOME/bin - will be used only on the run instance.
If you want to have these variables across multiple sessions append these entries to /etc/profile
I have downloaded ec2.py and ec2.ini files and placed them under
/etc/ansible/inventory
and i have changed the ansible.cfg to
inventory = /etc/ansible/inventory/ec2.py
i have environment variables set up as
export AWS_ACCESS_KEY_ID="XXXXXXXXXXXXXXX"
export AWS_SECRET_ACCESS_KEY="XXXXXXXXXXXXXXXXXXXXX"
export AWS_DEFAULT_REGION="us-east-1"
export EC2_INI_PATH="/etc/ansible/inventory/ec2.ini"
now when i run ansible -m ping all
i am getting
[WARNING]: provided hosts list is empty, only localhost is available
instead of pinging all instances in my account
when i run ./ec2.py --list i get
{
"_meta": {
"hostvars": {}
}
}
all my instances in aws are running
It seems you are not using the right inventory file.
Check ec2.py is executable (chmod +x)
Run ansible with -v option to check what config file it is really
using
ansible -v -m ping all
Check if you have ANSIBLE_INVENTORY or ANSIBLE_HOSTS environment
variables overriding expected config file. You can override inventory definition by setting
export ANSIBLE_INVENTORY=/etc/ansible/inventory/ec2.py
Remind that configuration files are processed in the following order
ANSIBLE_CONFIG (an environment variable)
ansible.cfg (in the current directory)
.ansible.cfg (in the home directory)
/etc/ansible/ansible.cfg
Prior to 1.5 the order was:
ansible.cfg (in the current directory)
ANSIBLE_CONFIG (an environment variable)
.ansible.cfg (in the home directory)
/etc/ansible/ansible.cfg
I've linked a git branch to my Elastic Beanstalk environment and using git aws.push it deploys correctly.
I've now added a .extensions directory which contains a config script which should be creating a couple of directories. However, nothing appears to be happening.
I understand that the .extensions directory should be copied across to the ec2 instance as well but I'm not seeing it.
I've checked eb-tools.log and it's not mentioned in the upload.
Is there something additional that's required?
The script contains:
commands:
cache:
command: mkdir /tmp/cache
items:
command: mkdir /tmp/cache/items
chmod:
command: chmod -R 644 /tmp
You can find the run logs for this at /var/log/cfn-init.log.
In here I could see that the mkdir commands had worked initially but subsequently failed as the directory already existed.
Turns out that eb extensions run commands in alphabetical order so I had to change the commands to:
01command1:
02command2:
etc.
From this point on it worked fine.
Something else that was confusing me is that the .ebextensions directory in my local git repo was not appearing on the target instance directory. this is because once it's been run it will delete the directory.
Double check that your local script file has a .config extension. I was having a similar problem because my local file was called .ebextensions/01_stuff.yaml and it was fixed once I renamed it to .ebextensions/01_stuff.config.
I'm trying to create multiple-boxes to be loaded by vagrant when writing
vagrant up kali
vagrant up metasploitable2
The Config I have set-up are
Within the Kali VagrantFile
Vagrant.configure("1") do |config|
config.vm.define "kali" do |kali|
kali.vm.box = "Kali"
end
end
Within the Metasploitable2
Vagrant.configure("1") do |config|
config.vm.define "metasploitable2" do |metasploitable2|
metasploitable2.vm.box = "metasploitable2"
end
end
If I browse to the directory where the .vmdk and Vagrantfile are located and say
vagrant up kali
it creates the kali image, however if i'm not in the directory it won't load the VM.
with an error:
The machine with the name 'kali' was not found configured for
this Vagrant environment.
I'm going to presume this is because it's not being able to read the configuration file, but how can i make this globally because I thought you weren't supposed to modify the 'global' vagrantfile at all.
Well, Vagrant has to find the Vagrantfile to read it, doesn't it? =)
So you either have to be in the same directory or any subdirectory below it. Or you can set VAGRANT_CWD environment variable to point to the directory. See the "Lookup Path" section in the Vagrantfile documentation for more information.
You can of course make wrapper script or other shortcuts if you need to use that often.
Btw, you might want to upgrade your Vagrantfiles to use V2 configuration format to use all new features of Vagrant 1.1+.