parent
361a307d8d
commit
afb35ebad8
@ -0,0 +1,147 @@
|
||||
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
|
@ -1,20 +0,0 @@
|
||||
const login_config = {
|
||||
type: 'checks',
|
||||
hosts: ['core', 'localhost', 'edge'],
|
||||
steps: [
|
||||
{
|
||||
type: 'os.alive',
|
||||
host: 'core',
|
||||
},
|
||||
{
|
||||
type: 'os.alive',
|
||||
host: 'edge',
|
||||
},
|
||||
{
|
||||
type: 'os.alive',
|
||||
host: 'localhost',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
module.exports = exports = login_config
|
@ -1,18 +0,0 @@
|
||||
const tmpdir_config = {
|
||||
type: 'checks',
|
||||
hosts: ['core', 'localhost'],
|
||||
steps: [
|
||||
{
|
||||
type: 'fs.directory',
|
||||
host: 'core',
|
||||
path: '/tmp/glmdev',
|
||||
},
|
||||
{
|
||||
type: 'fs.directory',
|
||||
host: 'localhost',
|
||||
path: '/tmp/glmdev',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
module.exports = exports = tmpdir_config
|
@ -1,16 +0,0 @@
|
||||
const updates_config = {
|
||||
type: 'checks',
|
||||
hosts: ['core', 'localhost'],
|
||||
steps: [
|
||||
{
|
||||
type: 'package.updates',
|
||||
host: 'core',
|
||||
},
|
||||
{
|
||||
type: 'package.updates',
|
||||
host: 'localhost',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
module.exports = exports = updates_config
|
Loading…
Reference in new issue