Skip to content

Commit

Permalink
kvm-control v2
Browse files Browse the repository at this point in the history
 * Chef-client setup is handled by jobs instead of projects
 * Better use of Ruby gems and rd command
 * New option to re-fetch Knife keys after initial install
 * Cleanup duplicate code
  • Loading branch information
c-buisson committed Jul 14, 2017
1 parent 6914df0 commit a1f874e
Show file tree
Hide file tree
Showing 32 changed files with 1,200 additions and 1,477 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

37 changes: 36 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
CHANGELOG
=========

2.6: 2017-07-14
---------------
New Features:
- New kvm-control job: "KVM: Delete all guests".
- New kvm-control job: "Docker: Restart chef-rundeck".
- Can re-fetch the Knife admin keys if needed.
- Rundeck-cli now usable by the Linux user that installed Mission_Control.
- Using job "Source: Add Cloud Image or ISO" to get the first source image.
- Using Rundeck "Source: Add Cloud Image or ISO" job to fetch first source image instead of separate script.

Updates:
- Merged chef-server-control and kvm-control_with-Chef projects into kvm-control.
- Load Rundeck jobs everytime the install script runs.
- Use new XML format for Rundeck jobs.
- Don't use 'bundle_install' method anymore. Use 'gem install' instead.
- Renamed 'third_octet' by 'third_byte'.
- Cleanup the use of the 'check_vars' method.
- Took out duplicate jobs in chef-rundeck_jobs.xml.erb.
- Updated get_ip_host logic.
- Use libvirt gem for KVM jobs.
- Don't need to get mysql-connector-java-5.1.40.tar.gz anymore.
- Don't use sudo command everywhere.
- Updated README.

Fixes:
- Don't restart Rundeck while installing KVM.

Removed:
- scripts/create_rd_projects.sh
- kvm/templates/get_images.rb.erb
- kvm/get_first_cloud_image.rb
- docker/template/rundeck_jobs-chef.xml.erb
- scripts/templates/Gemfile.erb
- scripts/get_interface_ip.rb

2.5: 2017-06-16
---------------
New Features:
Expand All @@ -10,7 +45,7 @@ New Features:
- Using chef-rundeck in a container.

Updates:
- Using newer Docker image (v2.3).
- Using newer chef-server Docker image (v2.3).
- Shell and Ruby lint.
- Output color for the bash scripts.
- New env variable for libvirt.
Expand Down
4 changes: 0 additions & 4 deletions Gemfile

This file was deleted.

99 changes: 49 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,90 @@
#Mission_Control
# Mission_Control

##Description
## Description

Mission_Control is a set of Rundeck projects that lets you `create / start / shutdown / destroy` virtual machines and containers.

##Installation
## Installation

You will need to execute the `install` script to install all the required packages, gems and lay down the configuration files.
First, edit the `vars` file with your parameters. Then, you will need to execute the `install` script to install all the required packages, gems and lay down the configuration files.
```bash
cbuisson@server:~/mission_control$ ./install
```
To update the current configuration, edit the `vars` file and execute the `install` script again. The script can be run anytime.

./install
## Environment

**Variables:** You can edit the `vars` file to reflect your current environment or what you want. You can paste your SSH public keys here.
Mission_Control has been developed for a **brand new** install of **Ubuntu Xenial 16.04 LTS**.

The install process will display a menu where you can choose to install any feature that you want.
## Project: *kvm-control*

##Environment
Launch a new personalized KVM guest with:
- SSH public keys importation
- Automatic DNS entry creation
- Static IP assignment
- VNC accessibility
- Chef-client installed and configured

Mission_Control has been developed for **Ubuntu Xenial 16.04 LTS**.
kvm-control will launch the KVM guests with a fully qualified domain name `.local`. Bind9 will be installed/used by default to dynamically manage the DNS A and PTR records.

#*kvm-control*
kvm-control was designed to work with Class C IPs. The netmask is hard coded to: **255.255.255.0**.

You can choose to start a new virtual machine with an ISO or an Ubuntu Cloud image.
You can also choose to start a new virtual machine with an ISO or an Ubuntu Cloud image. When an Ubuntu Cloud image is used to launch a new instance, the KVM guest will get a static IP. ISO's on the other hand, will get a DHCP IP.

When an Ubuntu Cloud image is used to launch a new instance, the vm will get a static IP. ISO's on the other hand, will get a DHCP ip.
### Network setup (Floating IP / NAT IP)

###Network types:
*Netmask*: kvm-control was designed to work with Class C IPs, therefore the netmask is hard coded to: 255.255.255.0
You can choose to assign a floating IP (public address accessible by external servers on the same local network) or a NAT IP (private address accessible by the hypervisor only) when launching a new KVM guest in Rundeck. The guest will be assigned a static IP and a VNC port.

*Fqdn*: kvm-control will launch the KVM guests with a fully qualified domain name `.local`. Bind9 will be installed by default to dynamically manage the DNS A and PTR records. See `vars` file.
Deleting the KVM guest will release both the IP (floating or NAT) and the VNC port.

####Floating IPs
### Floating IPs

You will need to edit the `vars` file and add:
You will need to edit the `vars` file and already have created a Linux bridge interface:

- The interface out (**Must be br0** if using floating static IPs!)
- A backend type (*MySQL or PostgreSQL*)
- Interface out (**Must be named**: `br0`!)
- Start IP (*i.e 192.168.0.1*)
- End IP (*i.e 192.168.0.100*)
- Gateway IP (*i.e 192.168.0.254*)

Mission_Control will assign floating IPs to the KVM guests. Those floating IPs should be able to reach the hypervisor's IP and the gateway. You need to specify a floating IP range for the guests and a gateway to route out.

**NAT IPs**:

By default Libvirt will install a new interface `virbr0` that will be managed by a DNSmasq process. DNSmasq will assign IPs to the new KVM guest with DHCP. The default range is:

- *192.168.122.2 to 192.168.122.254*
The kvm-control's jobs will assign floating IPs to the KVM guests. These floating IPs should be able to reach the hypervisor and the gateway IPs.

You can choose to assign a floating IP or a NAT IP when launching a new guest in Rundeck (i.e `Launch KVM guest`). Either way, the guest will be assigned a reserve static IP and a VNC port.
### NAT IPs

Deleting the KVM guest will release both the IP (floating or NAT) and the VNC port.

#*chef_server-control*
By default, Libvirt will configure a new interface (`virbr0`) that will be managed by a DNSmasq process. DNSmasq will assign IPs to the new KVM guest with DHCP. The default range is from **192.168.122.2** to **192.168.122.254**.

This is a Docker container that come with Chef Server 11 already installed. Mission_Control will download and launch this container if you want to. It will also grab the Knife admin keys and configure the Rundeck user to be able to use Knife.
### Chef-Server

Also, the gem `chef-rundeck` will be installed and configure. This allows Rundeck to display Chef nodes directly in the "Nodes" panel. You can run command directly to the Chef nodes via Rundeck.
You can optionally bootstrap the KVM guests to a Chef-Server at launch time.
In order to use this feature, select the "Docker Chef container" option while running the `install` script. This option will appears after the installation of `kvm-control`.

#*docker-control*
Mission_Control will start the two following Docker instances:

You can manage Docker containers and images with this project.
**Chef-Server**: Comes with Chef Server 12 already installed and configured. Mission_Control will also grab the Knife admin keys and configure both your current user and the Rundeck user to be able to use the Knife command.

Assumptions
-----------
**Chef-Rundeck**: Allows Rundeck to display the Chef client nodes directly in the "Nodes" tab. Once visible, you can run commands directly to the Chef client nodes from the Rundeck UI.

###kvm-control:
### Notes

- VMs will reach the internet trough the hypervisor via `br0` if floating IP selected. While using NAT, `virbr0` will be used.
- KVM guests will reach the internet trough the hypervisor via `br0` when the floating IPs are selected.

- If a guest is launched with the NAT option, `virbr0` (192.168.122.1) will be used to route out.

###chef_server-control:

- The Docker Chef_Server will be accessible via HTTPS:$CHEF_PORT.
- The Chef-Server container will be accessible from the hypervisor via: HTTPS://$CHEF_SERVER_CONTAINER_NAME:$CHEF_PORT.

Requirements
-----------

###KVM
### KVM Requirements

The hypervisor should have `Virtual Technology` enabled. You can test this prior the installation by running:

ubuntu@cbuisson:~$ egrep -c '(vmx|svm)' /proc/cpuinfo
```bash
cbuisson@server:~$ egrep -c '(vmx|svm)' /proc/cpuinfo
#Anything but 0 is good.

```
And after the installation:

ubuntu@cbuisson:~$ kvm-ok
```bash
cbuisson@server:~$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
```

## Project: *docker-control*

You can manage Docker containers and images with this project.
Loading

0 comments on commit a1f874e

Please sign in to comment.