GithubHelp home page GithubHelp logo

theforeman / foreman_snapshot Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 4.0 26 KB

Plugin to handle taking a snapshot of a host group and pushing it back to a Compute Resource as a new image

License: GNU General Public License v3.0

Ruby 100.00%

foreman_snapshot's Introduction

== This project is now archived ==

Foreman Snapshot


A plugin to create images from Hostgroups

Installation

Please see the Foreman manual for appropriate instructions:

The gem name is "foreman_snapshot".

RPM users can install the "ruby193-rubygem-foreman_snapshot" or "rubygem-foreman_snapshot" packages. DEB users can install "ruby-foreman-snapshot"

Compatibility

Foreman Version Plugin Version
<= 1.4 not supported
> 1.4 0.1.0
Supported Compute Resources
Openstack
Libvirt

Usage

The plugin has no UI as yet, so send an API request to /api/v2/hostgroups/:id/snapshot. Replace :id with the hostgroup id as normal. See the sections below for examples for each compute resource.

The request will block until complete (unless using Dynflow & ForemanTasks, see below). This can take over 10 minutes for something like Libvirt, so be patient.

Openstack

Send an API request like this:

{
  "host": {
    "compute_resource_id": 7,
    "compute_attributes": {
      "flavor_ref": 1,
      "network": "public",
      "image_ref": "9c9d4946-3e33-4f6e-92f0-f3527ef42862"
    }
  }
}

Libvirt

For Libvirt you will need fog >= 1.21 for clone_volume support. Then send an API request like this:

{
  "host": {
    "compute_resource_id": 3,
    "compute_profile_id": 1,
    "compute_attributes": {
      "image_id": "",
      "image_ref": ""
    }
  }
}

Unsetting the image id/ref is important, otherwise the VM may boot with a backing volume instead of doing a fresh PXE install. You could specify compute_attributes explicitly instead of using a compute profile.

Optional: Set up Foreman Tasks

This plugin can use Dynflow & ForemanTasks to offload the slow process of building, configuring, and snapshotting the image.

To use this, first configure Foreman-Tasks and then continue with the normal opertion.

The API call should immediately return a Tasks id, and you should be able to view it in /foreman_tasks/tasks.

TODO

  • More Compute Resources (ovirt, ec2, etc)
  • Add Tests
  • Add UI

Copyright

Copyright (c) 2014 Red Hat

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

foreman_snapshot's People

Contributors

gregsutcliffe avatar

Stargazers

Maxim Burgerhout avatar Timo Goebel avatar  avatar Florian Maier avatar Varac avatar

Watchers

 avatar James Cloos avatar  avatar

foreman_snapshot's Issues

uninitialized constant Actions::EntryAction (NameError)

`
* [1]Phusion Passenger
Web application could not be started

uninitialized constant Actions::EntryAction (NameError)
/usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_snapshot-0.1.0/app/lib/actio
ns/foreman/hostgroup/snapshot.rb:5:in <module:Hostgroup>ʼ /usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_snapshot-0.1.0/app/lib/actio ns/foreman/hostgroup/snapshot.rb:3:in module:Foremanʼ
/usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_snapshot-0.1.0/app/lib/actio
ns/foreman/hostgroup/snapshot.rb:2:in <module:Actions>ʼ /usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_snapshot-0.1.0/app/lib/actio ns/foreman/hostgroup/snapshot.rb:1:in <top (required)>`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.