Skip to content

Ansible module for the vm-bhyve utility

License

Notifications You must be signed in to change notification settings

neapsix/ansible-vmbhyve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansible-vmbhyve

Ansible module to configure the bhyve hypervisor using vm-bhyve commands.

Features

You can use this module to create virtual switches and attach interfaces to them. Other commands and options are not supported. The available options provide declarative alternatives to running the following commands directly in a playbook.

  • vm switch create <switch>
  • vm switch add <switch> <interface>
  • vm switch remove <switch <interface>
  • vm switch destroy <switch>

Usage

To use this module, copy library/ into the same directory as your ansible inventory file, or copy vm-bhyve.py into your ansible modules directory. For example usage in a playbook, refer to the Examples section below and the test_play.yaml file.

Options

switch:
  description: name of switch to create, edit, or remove in vm-bhyve.
  required: true
  type: str

state:
  description:
    whether to create, remove, append to, or remove from switch configuration in vm-bhyve.
    - Use present to create or replace a switch.
    - Use absent to remove a switch.
    - Use value_present to create or add something to a switch.
    - Use value_absent to remove something from a switch.
  required: true
  type: str

interfaces:
  description: interfaces to attach to the switch.
  required: false
  type: str

Examples

Ensure a switch called public exists and is attached to interface em0 and no other interfaces.

- name: create a switch
  vm-bhyve:
    switch: public
    state: present
    interfaces: em0

Ensure the switch called public does not exist, destroying it if it does.

- name: destroy a switch
  vm-bhyve:
    switch: public
    state: absent

Add interfaces to an existing switch called public, creating the switch if it doesn't exist.

- name: update a switch
  vm-bhyve:
    switch: public
    state: value_present
    interfaces:
      - em1
      - em2

Remove an interface from an existing switch called public.

- name: update a switch
  vm-bhyve:
    switch: public
    state: value_absent
    interfaces: em1

Create a switch called public wth interfaces em0 and em1 and update it so that it has interfaces em0 and em3, removing em1.

- name: create a switch
  vm-bhyve:
    switch: public
    state: present
    interfaces:
      - em0
      - em1

- name: reconfigure a switch
  vm-bhyve:
    switch: public
    state: present
    interfaces:
      - em0
      - em3

To Do

  • Implement failed status.
  • Refactor to set changed status properly and return more useful results.

About

Ansible module for the vm-bhyve utility

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages