Skip to content

Instantly share code, notes, and snippets.

View stbenjam's full-sized avatar
🙃

Stephen Benjamin stbenjam

🙃
View GitHub Profile
If you lost some info from dhcpd.conf and want to retrieve the old copy,
puppet would have stored the overwritten configuration files in the
Filebucket. You'd see something like this in the installer logs:
/Stage[main]/Dhcp/File[/etc/dhcp/dhcpd.conf]: Filebucketed
/etc/dhcp/dhcpd.conf to puppet with sum
622d9820b8e764ab124367c68f5fa3a1
And it's restorable with:
[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
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
class apache::version {
case $::osfamily {
'RedHat': {
if $::operatingsystem == "Fedora" && $::operatingsystemrelease >= 18 {
apache_version = 2.4
} else {
apache_version = 2.2
}
}
'Debian': {
#kind: PXELinux
#name: Community Kickstart PXE
#oses:
#- CentOS 5
#- CentOS 6
#- Fedora 16
#- Fedora 17
#- Fedora 18
#- Fedora 19
#- RedHat 5
@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 / gist:2aa8f31bc869231d5f18
Created October 23, 2015 12:58
debian 8 api on http
/etc/salt/master:
external_auth:
pam:
saltuser:
- '@runner'
rest_cherrypy:
port: 9191
#!/usr/bin/env ruby
# This is the external nodes script to allow Salt to retrieve info about a host
# from Foreman. It also uploads a node's grains to Foreman, if the setting is
# enabled.
require 'yaml'
$settings_file = '/etc/salt/foreman.yaml'
SETTINGS = YAML.load_file($settings_file)
log {
module: DEFAULT
enable: debug+
timestamp: true
output: /var/log/qdrouterd.log
}
echo 'ForemanTasks::Task.where(:label => "Actions::Candlepin::ListenOnCandlepinEvents", :state => "running").map { |task| task.update_column(:state, "stopped") }' | foreman-rake console