Is it possible to differentiate a
puppet agent run from a
puppet apply run?
Is there a convenient environment variable or fact to check within my manifests?
$trusted['authenticated'] fact might work for you. The value will be:
This is one of the trusted facts in puppet, check out Puppet Labs' documentation for more details on this fact: https://docs.puppetlabs.com/puppet/latest/reference/lang_facts_and_builtin_vars.html#trusted-facts