Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephen Benjamin stbenjam

View GitHub Profile
@stbenjam
stbenjam / gist:6406438
Created Sep 1, 2013
sample vimrc for nova
View gist:6406438
set term=ansi
colorscheme desert
set backspace=indent,eol,start
syntax enable
@stbenjam
stbenjam / 10_freeipa_integration.sh
Last active Feb 28, 2020
FreeIPA <-> Foreman Integration
View 10_freeipa_integration.sh
#!/bin/bash
# Hook for Foreman/FreeIPA Integration
# Stephen Benjamin <stephen@bitbin.de>
# 11.11.2013
. /etc/sysconfig/foreman-ipa
action=$1 # create or destroy
target=$2 # hostname
View kickstart
#kind: PXELinux
#name: Community Kickstart PXE
#oses:
#- CentOS 5
#- CentOS 6
#- Fedora 16
#- Fedora 17
#- Fedora 18
#- Fedora 19
#- RedHat 5
View gist:8420033
class apache::version {
case $::osfamily {
'RedHat': {
if $::operatingsystem == "Fedora" && $::operatingsystemrelease >= 18 {
apache_version = 2.4
} else {
apache_version = 2.2
}
}
'Debian': {
View gist:8564784
test "should not save if root password is undefined and host is managed" do
Setting[:root_pass] = nil
host = Host.create :name => "myfullhost", :managed => true
assert !host.valid?
assert host.errors[:root_pass].include?("should not be blank")
end
test "should save if root password is undefined when the compute resource is image capapble"
Setting[:root_pass] = nil
host = Host.create :name => "myfullhost", :managed => true, :compute_resource_id => compute_resources(:openstack).id
View gist:8575084
[stbenjam@foreman-dev foreman]$ rails c test
For some operations a user must be set, try User.current = User.first
Loading test environment (Rails 3.2.16)
1.9.3-p448 :001 > host = Host.new :name => "myfullhost", :managed => true
[...]
1.9.3-p448 :003 > host.valid?
=> false
1.9.3-p448 :004 > host.errors[:root_pass].any?
=> true
View 20140312224442_add_index_to_lower_login.rb
class AddIndexToLowerLogin < ActiveRecord::Migration
def up
execute "CREATE INDEX lower_login ON users (LOWER(login))" if ActiveRecord::Base.connection.instance_of? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
end
def down
execute "DROP INDEX lower_login" if ActiveRecord::Base.connection.instance_of? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter;
end
end
View gist:10716619
E.g.
POST https://gatebuilder.bitbin.de/api/v2/smart_class_parameters/enable_sudo/override_values
{
"override_value": {
"match": "fqdn=asgard.bitbin.de",
"value": "unicorns"
}
}
View gist:11189195
[root@katello katello-deploy]# yum repolist
Loaded plugins: product-id, rhnplugin, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is receiving updates from RHN Classic or RHN Satellite.
repo id repo name status
SCL CentOS-6Server - SCL 532
epel Extra Packages for Enterprise Linux 6 - x86_64 10,724
foreman Foreman nightly
View gist:11299095
network --bootproto static --ip=<%= @host.ip %> --netmask=<%= @host.subnet.mask %> --gateway=<%= @host.subnet.gateway %> --nameserver=<%= [@host.subnet.dns_primary,@host.subnet.dns_secondary].reject{|n| n.blank?}.join(',') %> --hostname <%= @host %>
You can’t perform that action at this time.