Skip to content

Instantly share code, notes, and snippets.

All my code is public.

Lukáš Zapletal lzap

View GitHub Profile
@lzap
lzap / smart-proxy.patch
Created Mar 18, 2019
Grub2 in UEFI is known to have problems with relative paths - this makes Foreman to manage /grub.cfg-01-XXXXX files
View smart-proxy.patch
diff --git a/modules/tftp/server.rb b/modules/tftp/server.rb
index 4cbcff3..810ace9 100644
--- a/modules/tftp/server.rb
+++ b/modules/tftp/server.rb
@@ -98,7 +98,7 @@ module Proxy::TFTP
["#{pxeconfig_dir}/grub.cfg"]
end
def pxeconfig_file mac
- ["#{pxeconfig_dir}/grub.cfg-01-"+mac.tr(':','-').downcase]
+ ["#{pxeconfig_dir}/grub.cfg-01-"+mac.tr(':','-').downcase, "#{pxeconfig_dir}/../grub.cfg-01-"+mac.tr(':','-').downcase]
View httpboot_api.rb
class Proxy::HttpbootApi < Sinatra::Base
helpers ::Proxy::Helpers
head "/*" do
file = Pathname.new(params[:splat].first).cleanpath
root = Pathname.new(Proxy::Httpboot::Plugin.settings.root_dir).expand_path.cleanpath
joined_path = File.join(root, file)
log_halt(404, "Not found") unless File.exist?(joined_path)
real_file = Pathname.new(joined_path).realpath
log_halt(403, "Invalid or empty path") unless real_file.fnmatch?("#{root}/**")
View kexec-append-fix.erb
<%#
kind: kexec
name: Discovery Red Hat kexec
oses:
- CentOS 4
- CentOS 5
- CentOS 6
- CentOS 7
- Fedora 21
- Fedora 22
View gist:5d06d56e9712a73f0287f2f1ccb2082f
[root@rc ~]# foreman-installer -v --scenario foreman --puppet-runmode none --foreman-organizations-enabled true --foreman-initial-organization=MyOrg --foreman-locations-enabled true --foreman-initial-location=MyLoc --enable-foreman-plugin-discovery --enable-foreman-plugin-bootdisk --enable-foreman-plugin-remote-execution --enable-foreman-proxy-plugin-remote-execution-ssh --enable-foreman-plugin-openscap --enable-foreman-proxy-plugin-openscap --foreman-proxy-http=true --foreman-proxy-dns true --foreman-proxy-dns-interface --foreman-proxy-dns-forwarders 192.168.199.1 --foreman-proxy-dns-zone nat.lan --foreman-proxy-dns-reverse 199.168.192.in-addr.arpa --foreman-proxy-dhcp true --foreman-proxy-dhcp-interface --foreman-proxy-dhcp-gateway=192.168.199.1 '--foreman-proxy-dhcp-range=192.168.199.10 192.168.199.109' --foreman-proxy-dhcp-nameservers=192.168.199.4 --foreman-proxy-tftp true --foreman-proxy-tftp-servername=192.168.199.4 --foreman-proxy-puppet true --foreman-proxy-puppetca true --foreman-proxy-templates tru
@lzap
lzap / v2_features.json
Last active Jan 31, 2019
Foreman Smart Proxy V2 Features
View v2_features.json
{
"discovery": {
"http_enabled": true,
"https_enabled": true,
"state": "running"
},
"discovery_image": {
"http_enabled": true,
"https_enabled": true,
"state": "running"
View candlepin.xml
<appender name="SyslogAppender" class="ch.qos.logback.classic.net.SyslogAppender">
<syslogHost>localhost</syslogHost>
<facility>DAEMON</facility>
<suffixPattern>candlepin @cee:{"message":"%m","level":"%p","candlepin":{"logger":"%logger","thread":"%thread","request_type":"%X{requestType}","request_uuid":"%X{requestUuid}" },"foreman":{"request":"%X{csid}","org_name":"%X{org}" } }%n</suffixPattern>
</appender>
View gist:1f22ed72dcf3799eb4dd72eca9762c89
[lzap@box foreman-ansible-modules]$ ansible-playbook -vvv test.yaml
ansible-playbook 2.7.4
config file = /home/lzap/work/foreman-ansible-modules/ansible.cfg
configured module search path = ['/home/lzap/work/foreman-ansible-modules/modules']
ansible python module location = /usr/lib/python3.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.7.1 (default, Nov 23 2018, 10:01:49) [GCC 8.2.1 20181105 (Red Hat 8.2.1-5)]
Using /home/lzap/work/foreman-ansible-modules/ansible.cfg as config file
/home/lzap/work/foreman-ansible-modules/test/inventory/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
/home/lzap/work/foreman-ansible-modules/test/inventory/hosts did not meet script requirements, check plugin documentation if this is unexpected
@lzap
lzap / oneshot-example.service
Created Oct 17, 2018
Systemd oneshot example service
View oneshot-example.service
[Unit]
Description=My service
[Service]
Type=oneshot
ExecStart=/path/to/my/script.sh
#RemainAfterExit=true
[Install]
WantedBy=multi-user.target
@lzap
lzap / Ruby Foreman.sublime-build.json
Last active Sep 5, 2018
Foreman project sublime build file for Ruby 2.0+
View Ruby Foreman.sublime-build.json
{
"selector": "source.ruby",
"working_dir": "/home/lzap/work/foreman",
"cmd": [
"bundle", "exec", "rake", "test"
],
"variants": [
{
"name": "Run a single test",
"cmd": [
View ipxe_hack_sat62b.diff
diff --git a/modules/dhcp_isc/dhcp_isc_main.rb b/modules/dhcp_isc/dhcp_isc_main.rb
index 1ffb5d3..466e157 100644
--- a/modules/dhcp_isc/dhcp_isc_main.rb
+++ b/modules/dhcp_isc/dhcp_isc_main.rb
@@ -59,7 +59,7 @@ module Proxy::DHCP::ISC
options = record.options
# TODO: Extract this block into a generic dhcp options helper
statements = []
- statements << "filename = \\\"#{options[:filename]}\\\";" if options[:filename]
+ #statements << "filename = \\\"#{options[:filename]}\\\";" if options[:filename]
You can’t perform that action at this time.