diff --git a/src/content/_index.html b/src/content/_index.html index 3fb5346..e19afab 100644 --- a/src/content/_index.html +++ b/src/content/_index.html @@ -211,8 +211,10 @@ ansible-playbook ./ansible/playbooks/"$(hostname -f)".yml
# Compare two harvests and get a human-friendly report
-enroll diff --old /path/to/harvestA --new /path/to/harvestB --format markdown
+ # Compare two harvests and get a human-friendly report (ignoring noise)
+enroll diff --old /path/to/harvestA --new /path/to/harvestB --format markdown \
+ --exclude-path /var/anacron \
+ --ignore-package-versions
# Send a webhook when differences are detected
enroll diff \
@@ -221,7 +223,15 @@ enroll diff \
--webhook https://example.net/webhook \
--webhook-format json \
--webhook-header 'X-Enroll-Secret: ...' \
- --exit-code
+ --ignore-package-versions \
+ --exit-code
+
+# Ignore a path and changes to package versions, and optionally
+# enforce the old state locally (requires ansible-playbook)
+enroll diff --old /path/to/harvestA --new /path/to/harvestB \
+ --exclude-path /var/anacron \
+ --ignore-package-versions \
+ --enforce
$ enroll manifest --harvest /tmp/enroll-harvest --out /tmp/enroll-ansible --fqdn "$(hostname -f)"
$ ansible-playbook /tmp/enroll-ansible/playbooks/"$(hostname -f)".yml
+
+ role_<name> (e.g. role_users, role_services, role_other). You can target a subset with ansible-playbook ... --tags role_users.A great way to use enroll diff is to run it periodically (e.g via cron or a systemd timer). Below is an example.
--exclude-path to ignore file/dir drift under specific paths (e.g. /var/anacron). Use --ignore-package-versions to ignore routine package upgrades/downgrades while still reporting added/removed packages.$ enroll diff --old /path/to/harvestA --new /path/to/harvestB --exclude-path /var/anacron --ignore-package-versions
+ --enforce)ansible-playbook is on PATH, Enroll can generate a manifest from the old harvest and apply it locally to restore expected state. It avoids package downgrades, and will often run Ansible with --tags role_... so only the roles implicated by the drift are applied. This is very much like a return to Puppet's agent mode!Store the below file at /usr/local/bin/enroll-harvest-diff.sh and make it executable.
enroll diff$ enroll diff \
- --old /path/to/harvestA \
- --new /path/to/harvestB \
- --format markdown
+ $ enroll diff --old /path/to/harvestA --new /path/to/harvestB --format markdown --exclude-path /var/anacron --ignore-package-versions
$ enroll diff --old /path/to/golden --new /path/to/current \
- --webhook https://example.net/webhook \
+ --webhook https://example.net/webhook \
--webhook-format json \
- --webhook-header 'X-Enroll-Secret: ...' \
- --exit-code
+ --webhook-header 'X-Enroll-Secret: ...' \
+ --ignore-package-versions --exit-code
+
Use it in cron or CI to alert on change.
Great for answering "why did it include/exclude that file?" before you generate a manifest.
enroll diff --enforce$ enroll diff \
+ --old /path/to/harvestA \
+ --new /path/to/harvestB \
+ --enforce \
+ --format json
+
+ Enforcing the old harvest will restore its files/perms, missing packages, changed services or users, if ansible-playbook is on the PATH.