chouseknecht.minishift

Build Status

minishift-up-role

This role installs the latest version of minishift and sets up a minishift instance.

It does the following:

  • Downloads and installs the latest minishift binary.
  • Copies the latest oc binary from ~/.minishift/cache/oc to a directory in your system PATH.
  • Installs the Docker Machine driver.
  • Creates a minishift instance.
  • Grants cluster admin permissions to the developer account.
  • Creates a route for the internal registry.
  • Adds a hostname to /etc/hosts for accessing the internal registry.

Accessing the registry

After the role runs and minishift is active, you can access the internal registry using the openshift_hostname value, which defaults to local.openshift. You can log in by running:

$ docker login -u developer -p $(oc whoami -t) https://local.openshift

Supported platforms:

  • Debian
  • Red Hat
  • macOS

Prerequisites

  • Ansible version 2.4 or higher.
  • Clear any DOCKER* environment variables from your terminal session before running the role.
  • You need sudo access to install packages.

macOS

  • Install Homebrew.
  • Ansible version 2.2 or higher is required.

Mounting /Users to the Minishift VM

When the Minishift VM starts, the /Users folder will be mounted to the VM by setting the environment variable XHYVE_VIRTIO_9P=true. This variable is set temporarily.

Linux

  • Ensure KVM is installed and running. The role installs the Docker Machine driver for KVM, assuming KVM is already set up.
  • Ansible version 2.2 or higher is required.

Fedora

  • Install the packages python2-dnf and libselinux-python.

Known Issues

Fedora

  • You need to change the /etc/sysconfig/docker script to allow access to the Docker daemon on the Minishift instance. Modify the script by changing:

    DOCKER_CERT_PATH=/etc/docker
    

    to:

    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 to access the GitHub API.

  • minishift_release_tag_name: ""

    Defaults to installing the latest release. Use this to install a specific version.

  • minishift_dest: /usr/local/bin

    Directory for the minishift binary installation.

  • minishift_force_install: yes

    Overwrites any existing minishift binary at the specified location.

  • minishift_restart: yes

    Stops and recreates the current minishift instance.

  • minishift_delete: yes

    Runs minishift delete and removes ~/.minishift. This is often necessary when upgrading.

  • minishift_start_options: []

    List of options for the minishift start command, e.g., ['--memory', '4GB', '--cpus', '4'].

  • openshift_client_dest: /usr/local/bin

    Directory for the OpenShift client binary installation.

  • openshift_force_client_copy: yes

    Overwrites any existing OpenShift client binary at the specified location.

  • openshift_hostname: local.openshift

    Hostname for the local registry used when pushing images; added to /etc/hosts.

Example Playbook

Here’s a sample playbook with all the default parameters. You can find this example in the project root.

---
- name: Install minishift
  hosts: localhost
  connection: local
  gather_facts: yes
  roles:
    - role: chouseknecht.minishift
      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
      openshift_hostname: local.openshift

After installing the role, copy minishift-up.yml to your project directory and run it with the --ask-become-pass option. For example:

# Install the role 
$ ansible-galaxy install chouseknecht.minishift-up-role

# Copy the playbook to the working directory 
$ cp ${ANSIBLE_ROLES_PATH}/chouseknecht.minishift-up-role/minishift-up.yml .

# Create a local inventory file
$ echo "localhost">./inventory

# Run the playbook
$ ansible-playbook -i inventory --ask-become-pass minishift-up.yml

Dependencies

None

License

Apache v2

Author

@chouseknecht

Informazioni sul progetto

Run OpenShift locally using minishift

Installa
ansible-galaxy install chouseknecht.minishift
Licenza
apache-2.0
Download
365
Proprietario
Ansible Galaxy Engineering Manager