This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb | |
index e9af70b..8186708 100644 | |
--- a/app/helpers/application_helper.rb | |
+++ b/app/helpers/application_helper.rb | |
@@ -64,9 +64,10 @@ module ApplicationHelper | |
def link_to_add_puppetclass klass, type | |
options = klass.name.size > 28 ? {:'data-original-title'=>klass.name, :rel=>'twipsy'} : {} | |
content_tag(:span, truncate(klass.name, :length => 28), options).html_safe + | |
- link_to_function("", "add_puppet_class(this)", :'data-class-id'=>klass.id, | |
- :'data-original-title'=>"Click to add #{klass}", :rel=>'twipsy', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Virt | |
class Cache | |
attr_accessor :ttl | |
def initialize args | |
# default TTL is one hour | |
@ttl = args[:ttl] || 3600 | |
reset | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$hosts = foreman(item => 'hosts', | |
search => 'last_report > "1 week ago" and hostgroup = Clients', | |
per_page => 1000) | |
vpn_access{$hosts: ensure => enabled} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hosts with ip address and gateway facts | |
$hosts = foreman("fact_values", "fact = ipaddress or fact = gateway" | |
{"hostA":{"ipaddress":"10.35.27.3","gateway":"10.35.27.62"},"hostsB":{"ipaddress":"192.168.1.123","gateway":"192.168.1.254"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hosts with ip address and gateway facts | |
$hosts = foreman(item => 'fact_values', search => 'fact = ipaddress or fact = gateway') | |
{"hostA":{"ipaddress":"10.35.27.3","gateway":"10.35.27.62"},"hostsB":{"ipaddress":"192.168.1.123","gateway":"192.168.1.254"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# | |
USER="ci" | |
PASS="ci" | |
FOREMAN_URL="https://foreman.domain.org" | |
NAME=$1 | |
HOSTGROUP_ID="1" # Change this to your favorite hostgroup | |
curl -s -H "Accept:application/json" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# | |
USER="ci" | |
PASS="ci" | |
FOREMAN_URL="https://foreman.domain.org" | |
FQDN=$1 | |
curl -H "Accept:application/json" \ | |
-k -u $USER:$PASS -X DELETE \ | |
$FOREMAN_URL/hosts/$FQDN | prettify_json.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install foremancli | |
foremancli -h | |
Usage: foremancli [options] ... | |
-d, --debug Output more information | |
-u, --user USER Foreman user | |
-p, --pass PASSWORD Foreman password | |
-s, --server URL Foreman Server URL | |
--json JSON output | |
--yaml YAML output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/share/foreman/script/rails runner -e production | |
Host.all.each do |host| | |
next unless host.dhcp? | |
print "#{host}..." | |
dhcp_record = host.dhcp_record | |
if dhcp_record.valid? | |
puts "VALID" | |
elsif dhcp_record.conflicting? | |
puts "CONFLICT" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl http://foreman/unattended/script | bash | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
#!/bin/bash | |
KERNEL="/boot/kernel" | |
INITRD="/boot/initrd.img" | |
wget -O "$KERNEL" "http://centos.syn.co.il/5/os/x86_64/images/pxeboot/vmlinuz" |