magicalyak.minishift_up
minishift-up
This tool installs the latest version of minishift and sets up a minishift environment.
It does the following:
- Downloads and installs the latest minishift executable.
- Copies the latest OpenShift CLI (oc) tool to a directory in your PATH.
- Installs the Docker Machine driver.
- Creates a minishift instance.
- Grants cluster admin rights to the admin account.
Accessing the registry
Once the setup is complete and minishift is running, you can access the internal registry by running the following commands:
eval $(minishift docker-env)
docker login -u developer -p $(oc whoami -t)
Supported platforms
- Debian
- Red Hat
- OSX
Prerequisites
- Ansible 2.4 or newer.
- Clear any DOCKER* environment variables from your terminal before running the setup.
- You need sudo access to install packages.
- git (if using community addons).
- gnu tar (install with brew:
brew install gnu-tar
).
For OSX
- You need homebrew installed.
- Ansible 2.4+.
Mounting /Users to the Minishift VM
When the Minishift VM starts, the /Users volume will be mounted to it. You do this by setting the XHYVE_VIRTIO_9P=true
environment variable.
For Linux
- Ensure KVM is installed and working, as the setup installs the Docker Machine driver for KVM assuming it's already in place.
- Ansible 2.4 or newer.
For Fedora
- Install the packages
python2-dnf
andlibselinux-python
.
Known Issues
Fedora
Before using the Docker daemon in the Minishift instance, change the
/etc/sysconfig/docker
script to avoid overriding the DOCKER_CERT_PATH variable. Edit the line as follows:if [ -z "${DOCKER_CERT_PATH}" ]; then DOCKER_CERT_PATH=/etc/docker fi
Defaults
minishift_repo: minishift/minishift
Repository for the minishift binary.
minishift_github_url: https://api.github.com/repos
URL for accessing the GitHub API.
minishift_release_tag_name: ""
Installs the latest release by default. Specify to install a particular release.
minishift_dest: /usr/local/bin
Directory to install the minishift binary.
minishift_force_install: yes
Overwrites any existing minishift binary found in
minishift_dest
.
minishift_restart: yes
Stops and recreates the current minishift instance.
minishift_delete: yes
Runs
minishift delete
and removes~/.minishift
. Useful for upgrades.
minishift_start_options: []
List of options for
minishift start
, e.g.,['--memory', '4GB', '--cpus', '4']
.
openshift_client_dest: /usr/local/bin
Directory to install the OpenShift client binary.
openshift_force_client_copy: yes
Overwrites any existing OpenShift client binary found at
openshift_client_dest
.
minishift_experimental: no
Enable experimental features.
minishift_service_catalog: no
Enable the service catalog component.
use_hyperkit: no
For OSX, set to yes to try using hyperkit instead of xhyve.
minishift_addons_enable: no
Set to yes to enable addons.
minishift_addons_community_enable: no
Set to yes to use community addons and specify the path.
minishift_addons_community_path: $HOME/Downloads/git
Path to install community addons (must exist).
minishift_redhat_login: '123456|magicalyak'
minishift_redhat_password: 'token_stuff_stuff_token'
Set these for Red Hat Container Service account username and password.
Example Playbook
Here’s a sample playbook with all the default settings. You can find an example in the project’s root directory.
---
- name: Install minishift
hosts: localhost
connection: local
gather_facts: yes
roles:
- role: magicalyak.minishift_nginx
minishift_repo: minishift/minishift
minishift_github_url: https://api.github.com/repos
minishift_release_tag_name: ""
minishift_dest: /usr/local/bin
minishift_force_install: yes
minishift_restart: yes
minishift_delete: yes
minishift_start_options: []
openshift_client_dest: /usr/local/bin
openshift_force_client_copy: yes
minishift_experimental: no
minishift_service_catalog: no
use_hyperkit: yes
minishift_addons_enable: no
minishift_addons_community_enable: no
minishift_addons_community_path: $HOME/Downloads/git
To use the role after installation, copy minishift-nginx.yml into your project directory and run it with the --ask-become-pass
option like this:
# Install the role
$ ansible-galaxy install magicalyak.minishift_up
# Copy the playbook to the current directory
$ cp ${ANSIBLE_ROLES_PATH}/magicalyak.minishift_up/minishift-up.yml .
# Create a localhost inventory file
$ echo "localhost" > ./inventory
# Run the playbook
$ ansible-playbook -i inventory --ask-become-pass minishift-up.yml
Dependencies
- git (if using community addons).
- gnu-tar (install with brew:
brew install gnu-tar
).
License
Apache v2
Author
Credits
Most of this was adapted from Chris Houseknecht's role
minishift-up-role on Ansible Galaxy
@chouseknecht
ansible-galaxy install magicalyak.minishift_up