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
| class a { | |
| notify { '1': } | |
| notify { '2': } | |
| notify { '3': } | |
| } | |
| class b { | |
| Notify['3'] -> |
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
| class Klass | |
| attr_reader :number | |
| def initialize(number) | |
| @number = number | |
| end | |
| end | |
| # is the same as | |
| class Klass |
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
| Start-Transcript -path C:\wilhelm\finalize_transcript.txt -Append -Force | |
| $data = ConvertFrom-Json -InputObject(Get-Content 'C:\wilhelm\machine_data.json') | |
| $da_user = $data.domain_admin_user | |
| $da_pass = $data.domain_admin_pass | ConvertTo-SecureString -asPlainText -Force | |
| $credential = New-Object System.Management.Automation.PSCredential($da_user,$da_pass) | |
| #Create Credentials | |
| # Set IP address and Subnet Mask | |
| New-NetIPAddress -IPAddress $data.ip -AddressFamily IPv4 -InterfaceAlias Ethernet0 -PrefixLength $data.subnet_prefix -DefaultGateway $data.gateway |
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
| class Someclass | |
| attr_accessor :param | |
| def initialize(param_val=nil) | |
| @param = param_val || 'reasonable default' | |
| end | |
| 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
| def networks | |
| networks ||= self.datacenter.network.map do |dc_obj| | |
| [dc_obj.name,dc_obj] | |
| end.to_h | |
| networks | |
| 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
| define kerberos::setting ( | |
| $section, | |
| $setting, | |
| $value, | |
| ) { | |
| augeas { "krb5.conf-${title}": | |
| context => "/files/etc/krb5.conf/${section}", | |
| changes => "set ${setting} ${value}", | |
| } | |
| } |
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
| $users = ['zee','paul','luke'] | |
| $users.each |$user| { | |
| user { $user: | |
| ensure => present, | |
| } | |
| file { "/home/${user}": | |
| ensure => directory, | |
| owner => $user, |
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
| $foo = nil | |
| if $foo { | |
| notify { 'foo has truthiness': } | |
| } | |
| else { | |
| notify { 'foo has falsiness': } | |
| } |
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
| require 'hiera' | |
| module Wilhelm | |
| class Config | |
| class Hiera | |
| attr_reader :configpath,:datadir,:hierarchy | |
| def initialize(path) | |
| @configpath = path | |
| @hierarchy = hierarchy | |
| 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
| require 'yaml' | |
| module Wilhelm | |
| module Project | |
| class List | |
| attr_reader :projectfiles | |
| def initialize(projectdir='/etc/wilhelm/data/projects') | |
| @projectfiles = Dir["#{projectdir}/*"] |