John Ratliff
10/12/2022, 5:54 PMJohn Ratliff
10/12/2022, 5:57 PMcurl <http://localhost:8080/pdb/query/v4/nodes> This seems to list a lot of things. Is that what you're referring to?natemccurdy
10/12/2022, 6:02 PMbastelfreak
10/12/2022, 6:03 PMnatemccurdy
10/12/2022, 6:04 PMcurl -X GET <http://localhost:8080/pdb/query/v4> --data-urlencode 'query=nodes[certname] { report_timestamp <= "2022-10-05 00:00:00" }'natemccurdy
10/12/2022, 6:04 PMcurl -X GET <http://localhost:8080/pdb/query/v4> --data-urlencode 'query=nodes[certname] { report_timestamp <= "2022-10-05 00:00:00" }'John Ratliff
10/12/2022, 6:17 PMpuppet query "nodes[certname,report_timestamp] { report_timestamp >= '$(date --date '7 days ago' +'%Y-%m-%dT%H:%M:%S')' }" This seems like what I want. Thanks.John Ratliff
10/12/2022, 6:17 PMvchepkov
10/12/2022, 6:18 PMcatalog_timestamp insteadJohn Ratliff
10/12/2022, 6:19 PMvchepkov
10/12/2022, 6:19 PMold_timestamp=$(date -u -d '-7 days' -Isec)
/opt/puppetlabs/bin/puppet-query "nodes[certname]{catalog_timestamp < \"$old_timestamp\"}" | jq -r '.[].certname'vchepkov
10/12/2022, 6:21 PMJohn Ratliff
10/12/2022, 6:22 PMpuppet query "nodes[certname]{catalog_timestamp > '$(date -u -d '-7 days' -Isec)'}" | jq -r '.[].certname' | sort > active_puppet_servers.txtLumiere
10/12/2022, 9:58 PMWilliam Myers
10/12/2022, 11:33 PMif $::osfamily =~ '(Redhat|Debian)' {William Myers
10/12/2022, 11:33 PMif $::osfamily =~ '(Redhat|Debian)' {William Myers
10/12/2022, 11:35 PMif $trusted['certname'] =~ /^www(\d+)\./ {
notice("Welcome to web server number $1.")
}natemccurdy
10/12/2022, 11:43 PMWilliam Myers
10/12/2022, 11:43 PMif $::osfamily =~ /(Debian|RedHat)/ {natemccurdy
10/12/2022, 11:46 PMif $facts['os']['family'] in ["Debian", "RedHat"] {
}
I like in for checking multiple strings, personally.natemccurdy
10/12/2022, 11:46 PMif $facts['os']['family'] in ["Debian", "RedHat"]
I like in for checking multiple strings, personally.natemccurdy
10/12/2022, 11:46 PMif $facts['os']['family'] in ["Debian", "RedHat"] {
}
I like in for checking multiple strings, personally.natemccurdy
10/12/2022, 11:46 PMWilliam Myers
10/12/2022, 11:47 PMnatemccurdy
10/12/2022, 11:47 PM|.natemccurdy
10/12/2022, 11:48 PM$facts hash. That has a functional difference in that it’s more stable across Puppet versions (especially future versions).glee
10/12/2022, 11:49 PMif $facts['os'['family'] =~ /^(Debian|RedHat)$/ {
ie: to match Debian or RedHat exactly (whereas w/out anchors it could match someDebianwithsuffixtrailing etcglee
10/12/2022, 11:50 PMnatemccurdy
10/12/2022, 11:50 PMin operator does full-string comparison.William Myers
10/12/2022, 11:50 PM