Module to manage filesystem snapshots with snapper
New in version 2016.11.0.
codeauthor: | Duncan Mac-Vicar P. <dmacvicar@suse.de> |
---|---|
codeauthor: | Pablo Suárez Hernández <psuarezhernandez@suse.de> |
depends: |
dbus Python module. |
depends: |
snapper http://snapper.io, available in most distros |
maturity: | new |
platform: | Linux |
Returns the files changed between two snapshots
CLI example:
salt '*' snapper.changed_files salt '*' snapper.changed_files num_pre=19 num_post=20
Creates a snapshot marked as baseline
CLI Example:
salt '*' snapper.create_baseline salt '*' snapper.create_baseline my_custom_baseline
Creates a new Snapper configuration
CLI example:
salt '*' snapper.create_config name=myconfig subvolume=/foo/bar/ fstype=btrfs salt '*' snapper.create_config name=myconfig subvolume=/foo/bar/ fstype=btrfs template="default" salt '*' snapper.create_config name=myconfig subvolume=/foo/bar/ fstype=btrfs extra_opts='{"NUMBER_CLEANUP": False}'
Creates an snapshot
Returns the number of the created snapshot.
CLI example:
salt '*' snapper.create_snapshot
Deletes an snapshot
CLI example:
salt '*' snapper.delete_snapshot 54 salt '*' snapper.delete_snapshot config=root 54 salt '*' snapper.delete_snapshot config=root snapshots_ids=[54,55,56]
Returns the differences between two snapshots
CLI Example:
salt '*' snapper.diff salt '*' snapper.diff filename=/var/log/snapper.log num_pre=19 num_post=20
Returns the changes applied by a jid
CLI Example:
salt '*' snapper.diff_jid jid=20160607130930720112
Retrieves all values from a given configuration
CLI example:
salt '*' snapper.get_config
Get detailed information about a given snapshot
CLI example:
salt '*' snapper.get_snapshot 1
List all available configs
CLI example:
salt '*' snapper.list_configs
List available snapshots
CLI example:
salt '*' snapper.list_snapshots config=myconfig
Modify attributes of an existing snapshot.
CLI example:
salt '*' snapper.modify_snapshot 54 description="my snapshot description" salt '*' snapper.modify_snapshot 54 description="my snapshot description" salt '*' snapper.modify_snapshot 54 userdata='{"foo": "bar"}' salt '*' snapper.modify_snapshot snapshot_id=54 cleanup="number"
Runs a function from an execution module creating pre and post snapshots and associating the salt job id with those snapshots for easy undo and cleanup.
This would run append text to /etc/motd using the file.append module, and will create two snapshots, pre and post with the associated metadata. The jid will be available as salt_jid in the userdata of the snapshot.
You can immediately see the changes
CLI Example:
salt '*' snapper.run file.append args='["/etc/motd", "some text"]'
Set configuration values
CLI example:
salt '*' snapper.set_config SYNC_ACL=True
Keys are case insensitive as they will be always uppercased to snapper convention. The above example is equivalent to:
salt '*' snapper.set_config sync_acl=True
Returns a comparison between two snapshots
CLI example:
salt '*' snapper.status salt '*' snapper.status num_pre=19 num_post=20
Converts a numeric dbus snapper status into a string
CLI Example:
salt '*' snapper.status_to_string <dbus_status>
Undo all file changes that happened between num_pre and num_post, leaving the files into the state of num_pre.
Warning
If one of the files has changes after num_post, they will be overwritten The snapshots are used to determine the file list, but the current version of the files will be overwritten by the versions in num_pre.
You to undo changes between num_pre and the current version of the files use num_post=0.
CLI Example:
salt '*' snapper.undo
Undo the changes applied by a salt job
CLI Example:
salt '*' snapper.undo_jid jid=20160607130930720112
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.snapper.html