const example_routine = { type: 'checks', hosts: ['localhost', 'other_server'], steps: [ { // State: the file exists on the host type: 'fs.file', host: 'localhost', // localhost | other_server path: '/tmp/some.file', }, { // State: the directory exists on the host type: 'fs.directory', host: 'localhost', path: '/tmp/some.directory', }, { // State: the archive is unpacked into the destination type: 'fs.unpack', host: 'localhost', path: '/tmp/some.zip', // or /tmp/some.tar.gz destination: '/tmp/destination.dir', format: 'zip', // Optional: tar | zip (by default, from file extension) }, { // State: the path is packed into a destination archive type: 'fs.pack', host: 'localhost', path: '/tmp/some.directory/or.file', destination: '/tmp/packed.tar.gz', format: 'tar', // Optional: tar | zip (by default, from file extension) }, { // State: the fs permissions are set to the specified level type: 'fs.permission', host: 'localhost', path: '/tmp/some.directory/or.file', level: '644', // Some chmod permission level recursive: true, // default: false, revert_to: '555', // Permissions to revert to on undo, optional }, { // State: the fs owners are set to the specified user/group type: 'fs.ownership', host: 'localhost', owners: { // Specify one or both of the following: user: 'some_user', group: 'some_group', }, path: '/tmp/some.file/or.dir', recursive: true, // default: false revert_to: { user: 'root', group: 'root', }, }, { // State: the source repo is cloned into the path type: 'git.clone', host: 'localhost', path: '/tmp/some.dir.on.host', source: 'https://git.host/some/repo', }, { // State: the specified ref is checked out type: 'git.checkout', host: 'localhost', path: '/tmp/some.dir.on.host', target: 'develop', // ref to check out revert_to: 'master', // ref to revert to on undo }, { // State: the specified tag exists type: 'git.tag', host: 'localhost', path: '/tmp/some.dir.on.host', tag: 'rc-1', // tag to be created }, { // State: the command has been run type: 'os.cmd', host: 'localhost', cmd: 'useradd some_user', // Command to run on execute reverse: 'userdel some_user', // Command to run on undo }, { // State: the host is alive and responding type: 'os.alive', host: 'localhost', }, { // State: the package is installed on the host type: 'package.present', host: 'localhost', package: 'gcc', }, { // State: the package is not installed on the host type: 'package.absent', host: 'localhost', package: 'gcc', }, { // State: the packages are all up to date type: 'package.updates', host: 'localhost', }, { // State: the package cache has been cleared type: 'package.cache.clear', host: 'localhost', }, { // State: the specified service(s) is (are) running type: 'service.running', host: 'localhost', service: 'apache2', // or array of services: ['apache2', 'redis'] }, { // State: the specified service(s) is (are) stopped type: 'service.stopped', host: 'localhost', service: 'apache2', // or array of services: ['apache2', 'redis'] }, { // State: the specified service(s) has (have) been restarted type: 'service.restarted', host: 'localhost', service: 'apache2', // or array of services: ['apache2', 'redis'] }, { // State: the service daemon has been reloaded type: 'service.daemon.reloaded', host: 'localhost', }, { // State: the source file has been downloaded to the destination path type: 'web.download', host: 'localhost', method: 'get', // HTTP verb source: 'https://static.garrettmills.dev/assets/flitter/flitter_f.png', path: '/tmp/flitter_f.png', }, ], } module.exports = exports = example_routine