Skip to content

Instantly share code, notes, and snippets.

View stbenjam's full-sized avatar
🙃

Stephen Benjamin stbenjam

🙃
View GitHub Profile
@stbenjam
stbenjam / gist:6406438
Created September 1, 2013 18:50
sample vimrc for nova
set term=ansi
colorscheme desert
set backspace=indent,eol,start
syntax enable
@stbenjam
stbenjam / 10_freeipa_integration.sh
Last active May 29, 2023 15:30
FreeIPA <-> Foreman Integration
#!/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
#kind: PXELinux
#name: Community Kickstart PXE
#oses:
#- CentOS 5
#- CentOS 6
#- Fedora 16
#- Fedora 17
#- Fedora 18
#- Fedora 19
#- RedHat 5
class apache::version {
case $::osfamily {
'RedHat': {
if $::operatingsystem == "Fedora" && $::operatingsystemrelease >= 18 {
apache_version = 2.4
} else {
apache_version = 2.2
}
}
'Debian': {
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
[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
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
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"
}
}
[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
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 %>