Commit b9f5d9ed authored by Noe Nieto's avatar Noe Nieto 💬
Browse files

Add restart command

parent d8a2349f
......@@ -101,9 +101,9 @@ $
**Note**: Vagrant/libvirt need root access to create and modify networks on the machine. Vagrant will try to use sudo and will request your passowrd.
### The `up` and `halt` commands
### The `up`, `halt` and `restart` commands
Use these commands to start and shutdown the VM's. As an example, the previous section we created one vm. If we check the status we find that it's running.
Use these commands to start and shutdown, or restart the VM's. As an example, the previous section we created one vm. If we check the status we find that it's running.
```
$ shipyard status
......@@ -160,6 +160,26 @@ Total 1 machine(s)
$
```
Now, `restart` is very straightforward.
```
$ shipyard restart starblade
==> starblade: Halting domain...
Bringing machine 'starblade' up with 'libvirt' provider...
==> starblade: Checking if box 'debian/stretch64' is up to date...
==> starblade: Starting domain.
==> starblade: Waiting for domain to get an IP address...
==> starblade: Waiting for SSH to become available...
==> starblade: Creating shared folders metadata...
==> starblade: Exporting NFS shared folders...
==> starblade: Preparing to edit /etc/exports. Administrator privileges will be required...
==> starblade: Mounting NFS shared folders...
==> starblade: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> starblade: flag to force provisioning. Provisioners marked to run always will still run.
$
```
### The `ssh` command
The ssh command opens an ssh to the VM.
......
......@@ -197,6 +197,7 @@ COMMANDS = {
'create': 'Creates a new VM using vagrant and libvirt (KVM)',
'up': 'Start VM',
'halt': 'Stop/shutdown a VM',
'restart': 'Restarts the VM',
'destroy': 'Destroy the VM and do cleanup',
'ssh': 'Connect to the vm using SSH',
'playbook': 'Run a playbook against a machine',
......@@ -242,6 +243,9 @@ if __name__ == '__main__':
start_vm(sub_args.hostname)
if cmd_args.command == 'halt':
halt_vm(sub_args.hostname)
if cmd_args.command == 'restart':
halt_vm(sub_args.hostname)
start_vm(sub_args.hostname)
elif cmd_args.command == 'destroy':
destroy_vm(sub_args.hostname)
elif cmd_args.command == 'ssh':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment