Skip to content

Instantly share code, notes, and snippets.

@moedes
moedes / inventory.yaml
Last active May 13, 2020 15:41
Bolt Workshop Inventory File
---
version: 2
groups:
- name: linux
config:
transport: ssh
ssh:
host-key-check: false
user: centos
run-as: root
@moedes
moedes / timesync.ps1
Created April 2, 2020 21:46
Bolt Workshop Powershell Timesync script
[CmdletBinding()]
Param(
[Parameter(Mandatory = $True)] [Boolean] $Restart
)
echo "Reconfiguring W32Time..."
w32tm /config /syncfromflags:MANUAL /manualpeerlist:"0.nl.pool.ntp.org 1.nl.pool.ntp.org" /update
echo ""
echo "Resyncing clock..."
w32tm /resync
@moedes
moedes / time_sync.ps1
Created April 6, 2020 20:19
Time Sync Script
echo "Reconfiguring W32Time..."
w32tm /config /syncfromflags:MANUAL /manualpeerlist:"0.nl.pool.ntp.org 1.nl.pool.ntp.org" /update
echo ""
echo "Resyncing clock..."
w32tm /resync
echo ""
echo "Current time source:"
w32tm /query /source
echo ""
echo "All configured time sources:"
@moedes
moedes / bolt.yaml
Created April 6, 2020 20:21
Bolt Workshop YAML file
ssh:
host-key-check: false
winrm:
ssl: false
mod 'puppetlabs-stdlib', '5.1.0'
mod 'puppetlabs-registry', '2.1.0'
mod 'ncorrare-windowstime', '0.4.3'
mod 'puppetlabs-ntp', '7.3.0'
class { 'windowstime':
servers => { '0.nl.pool.ntp.org' => '0x08',
'1.nl.pool.ntp.org' => '0x08',
'2.nl.pool.ntp.org' => '0x08',
}
}
{
"description": "Configures Windows Time via powershell",
"input_method": "powershell",
"parameters": {
"restart": {
"description": "Restart the service after configuration",
"type": "Boolean"
}
}
}
plan tools::timesync(
TargetSpec $targets,
) {
run_task('tools::timesync', $targets, restart => false)
run_task('service::windows', $targets, name => 'W32Time', action => 'restart')
}
plan tools::timesync_code(
TargetSpec $targets,
) {
apply_prep($targets)
apply($targets) {
case $facts['kernel'] {
'Linux': {
class { 'ntp':
servers => [ '0.nl.pool.ntp.org',