Commandes Linux : vagrant ssh

VAGRANT SSH

Commande : vagrant ssh
Usage: vagrant ssh [options] [name|id] [-- extra ssh args]

Options:

    -c, --command COMMAND            Execute an SSH command directly
    -p, --plain                      Plain mode, leaves authentication up to user
    -t, --[no-]tty                   Enables tty when executing an ssh command (defaults to true)
    -h, --help                       Print this help

 

Se connecter à une machine Vagrant via SSH

vagrant ssh [options] [name|id] [-- extra ssh args]

Le fichier Vagrantfile est situé dans le répertoire courant.
ex :

$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
New release '14.04.5 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Welcome to your Vagrant-built virtual machine.
Last login: Fri Sep 14 06:23:18 2012 from 10.0.2.2
vagrant@precise64:~$

 

Exécuter une commande sur la machine Vagrant et quitter

vagrant ssh -c "<command>"

ex :

$ vagrant ssh -c "sudo yum update -y"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.clouvider.net
 * extras: mirror.clustered.net
 * updates: mirror.clustered.net
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package acl.x86_64 0:2.2.49-6.el6 will be updated
---> Package acl.x86_64 0:2.2.49-7.el6_9.1 will be an update
[...]

 

Fermer le menu
%d blogueurs aiment cette page :