dopi 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +322 -0
  6. data/Gemfile +7 -0
  7. data/Gemfile.lock +102 -0
  8. data/LICENSE.txt +177 -0
  9. data/README.md +309 -0
  10. data/Rakefile +44 -0
  11. data/Vagrantfile +64 -0
  12. data/bin/dopi +4 -0
  13. data/doc/getting_started.md +247 -0
  14. data/doc/getting_started_examples/001_hello_world.yaml +17 -0
  15. data/doc/getting_started_examples/002_connecting_over_ssh.yaml +35 -0
  16. data/doc/plugins/custom.md +88 -0
  17. data/doc/plugins/mco/rpc.md +82 -0
  18. data/doc/plugins/ssh/custom.md +141 -0
  19. data/doc/plugins/ssh/file_contains.md +37 -0
  20. data/doc/plugins/ssh/file_deploy.md +52 -0
  21. data/doc/plugins/ssh/file_exists.md +31 -0
  22. data/doc/plugins/ssh/file_replace.md +37 -0
  23. data/doc/plugins/ssh/puppet_agent_run.md +50 -0
  24. data/doc/plugins/ssh/reboot.md +22 -0
  25. data/doc/plugins/ssh/wait_for_login.md +53 -0
  26. data/doc/plugins/winrm/cmd.md +161 -0
  27. data/doc/plugins/winrm/file_contains.md +39 -0
  28. data/doc/plugins/winrm/file_exists.md +31 -0
  29. data/doc/plugins/winrm/powershell.md +27 -0
  30. data/doc/plugins/winrm/puppet_agent_run.md +49 -0
  31. data/doc/plugins/winrm/reboot.md +17 -0
  32. data/doc/plugins/winrm/wait_for_login.md +55 -0
  33. data/dopi.gemspec +42 -0
  34. data/lib/dopi/cli/command_add.rb +35 -0
  35. data/lib/dopi/cli/command_list.rb +19 -0
  36. data/lib/dopi/cli/command_remove.rb +31 -0
  37. data/lib/dopi/cli/command_reset.rb +27 -0
  38. data/lib/dopi/cli/command_run.rb +68 -0
  39. data/lib/dopi/cli/command_show.rb +109 -0
  40. data/lib/dopi/cli/command_update.rb +37 -0
  41. data/lib/dopi/cli/command_validate.rb +27 -0
  42. data/lib/dopi/cli/global_options.rb +55 -0
  43. data/lib/dopi/cli/log.rb +33 -0
  44. data/lib/dopi/cli.rb +57 -0
  45. data/lib/dopi/command/custom.rb +52 -0
  46. data/lib/dopi/command/dummy.rb +27 -0
  47. data/lib/dopi/command/mco/rpc.rb +158 -0
  48. data/lib/dopi/command/ssh/custom.rb +48 -0
  49. data/lib/dopi/command/ssh/file_contains.rb +70 -0
  50. data/lib/dopi/command/ssh/file_deploy.rb +71 -0
  51. data/lib/dopi/command/ssh/file_exists.rb +54 -0
  52. data/lib/dopi/command/ssh/file_replace.rb +96 -0
  53. data/lib/dopi/command/ssh/puppet_agent_run.rb +63 -0
  54. data/lib/dopi/command/ssh/reboot.rb +50 -0
  55. data/lib/dopi/command/ssh/wait_for_login.rb +68 -0
  56. data/lib/dopi/command/winrm/cmd.rb +44 -0
  57. data/lib/dopi/command/winrm/file_contains.rb +66 -0
  58. data/lib/dopi/command/winrm/file_exists.rb +51 -0
  59. data/lib/dopi/command/winrm/powershell.rb +16 -0
  60. data/lib/dopi/command/winrm/puppet_agent_run.rb +61 -0
  61. data/lib/dopi/command/winrm/reboot.rb +33 -0
  62. data/lib/dopi/command/winrm/wait_for_login.rb +49 -0
  63. data/lib/dopi/command.rb +239 -0
  64. data/lib/dopi/command_parser/arguments.rb +38 -0
  65. data/lib/dopi/command_parser/credentials.rb +59 -0
  66. data/lib/dopi/command_parser/env.rb +37 -0
  67. data/lib/dopi/command_parser/exec.rb +27 -0
  68. data/lib/dopi/command_parser/exit_code.rb +73 -0
  69. data/lib/dopi/command_parser/output.rb +126 -0
  70. data/lib/dopi/command_set.rb +66 -0
  71. data/lib/dopi/connector/local.rb +77 -0
  72. data/lib/dopi/connector/ssh.rb +170 -0
  73. data/lib/dopi/connector/winrm.rb +167 -0
  74. data/lib/dopi/error.rb +43 -0
  75. data/lib/dopi/log.rb +18 -0
  76. data/lib/dopi/node.rb +70 -0
  77. data/lib/dopi/plan.rb +99 -0
  78. data/lib/dopi/pluginmanager.rb +62 -0
  79. data/lib/dopi/state.rb +226 -0
  80. data/lib/dopi/state_store.rb +155 -0
  81. data/lib/dopi/step.rb +227 -0
  82. data/lib/dopi/step_set.rb +70 -0
  83. data/lib/dopi/version.rb +3 -0
  84. data/lib/dopi.rb +165 -0
  85. data/spec/command_helper.rb +11 -0
  86. data/spec/fixtures/mco_client.cfg +26 -0
  87. data/spec/fixtures/plans/fail_on_timeout.yaml +20 -0
  88. data/spec/fixtures/plans/hello_world.yaml +34 -0
  89. data/spec/fixtures/plans/non_existing_node.yaml +26 -0
  90. data/spec/fixtures/plans/test_role_variable.yaml +29 -0
  91. data/spec/fixtures/puppet/Puppetfile +8 -0
  92. data/spec/fixtures/puppet/Puppetfile.lock +57 -0
  93. data/spec/fixtures/puppet/hiera.yaml +6 -0
  94. data/spec/fixtures/puppet/manifests/site.pp +52 -0
  95. data/spec/fixtures/test_configuration.yaml +54 -0
  96. data/spec/fixtures/test_credentials.yaml +11 -0
  97. data/spec/fixtures/test_deloyed_file.txt +5 -0
  98. data/spec/fixtures/test_infrastructure.yaml +12 -0
  99. data/spec/fixtures/test_nodes.yaml +45 -0
  100. data/spec/fixtures/testenv_plan.yaml +159 -0
  101. data/spec/integration/dopi/addrun_spec.rb +31 -0
  102. data/spec/integration/dopi/cli/command_run_spec.rb +38 -0
  103. data/spec/integration/dopi/cli/global_options_spec.rb +128 -0
  104. data/spec/integration/dopi/command_spec.rb +66 -0
  105. data/spec/integration/dopi/fail_check_plans/file_exists_fails.yaml +38 -0
  106. data/spec/integration/dopi/fail_check_plans/output_parser.yaml +39 -0
  107. data/spec/integration/dopi/fail_check_plans/powershell_fail.yaml +25 -0
  108. data/spec/integration/dopi/fail_check_plans/timeout.yaml +29 -0
  109. data/spec/integration/dopi/fail_check_plans/verify_commands.yaml +33 -0
  110. data/spec/integration/dopi/failplan.rb +27 -0
  111. data/spec/integration/dopi/plan.rb +27 -0
  112. data/spec/integration/dopi/plans/dummy.yaml +29 -0
  113. data/spec/integration/dopi/plans/max_per_role.yaml +55 -0
  114. data/spec/integration/dopi/plans/no_timeout.yaml +29 -0
  115. data/spec/integration/dopi/plans/node_and_role_patterns.yaml +58 -0
  116. data/spec/integration/dopi/plans/node_by_config.yaml +116 -0
  117. data/spec/integration/dopi/plans/plugin_defaults.yaml +86 -0
  118. data/spec/integration/dopi/plans/plugins/mco/rpc.yaml +33 -0
  119. data/spec/integration/dopi/plans/plugins/ssh/custom.yaml +97 -0
  120. data/spec/integration/dopi/plans/plugins/ssh/file_contains.yaml +51 -0
  121. data/spec/integration/dopi/plans/plugins/ssh/file_deploy.yaml +82 -0
  122. data/spec/integration/dopi/plans/plugins/ssh/file_exists.yaml +69 -0
  123. data/spec/integration/dopi/plans/plugins/ssh/file_replace.yaml +55 -0
  124. data/spec/integration/dopi/plans/plugins/ssh/puppet_agent_run.yaml +45 -0
  125. data/spec/integration/dopi/plans/plugins/ssh/reboot.yaml +43 -0
  126. data/spec/integration/dopi/plans/plugins/ssh/wait_for_login.yaml +45 -0
  127. data/spec/integration/dopi/plans/plugins/winrm/cmd.yaml +39 -0
  128. data/spec/integration/dopi/plans/plugins/winrm/file_contains.yaml +51 -0
  129. data/spec/integration/dopi/plans/plugins/winrm/file_exists.yaml +69 -0
  130. data/spec/integration/dopi/plans/plugins/winrm/reboot.yaml +31 -0
  131. data/spec/integration/dopi/plans/resolve_roles_on_validate.yaml +23 -0
  132. data/spec/integration/dopi/plans/ssh_parallel.yaml +37 -0
  133. data/spec/integration/dopi/plans/verify_commands.yaml +49 -0
  134. data/spec/spec_helper.rb +104 -0
  135. data/spec/unit/dopi/command/custom_spec.rb +58 -0
  136. data/spec/unit/dopi/command/mco/rpc_spec.rb +157 -0
  137. data/spec/unit/dopi/command/ssh/custom_spec.rb +30 -0
  138. data/spec/unit/dopi/command/ssh/file_deploy_spec.rb +42 -0
  139. data/spec/unit/dopi/command/ssh/file_replace_spec.rb +35 -0
  140. data/spec/unit/dopi/command_parser/credentials_spec.rb +53 -0
  141. data/spec/unit/dopi/command_parser/exit_code_spec.rb +63 -0
  142. data/spec/unit/dopi/command_parser/output_spec.rb +129 -0
  143. data/spec/unit/dopi/command_spec.rb +14 -0
  144. data/spec/unit/dopi/connector/winrm_spec.rb +111 -0
  145. data/spec/unit/dopi/node_spec.rb +24 -0
  146. data/spec/unit/dopi/plan_spec.rb +31 -0
  147. data/spec/unit/dopi/state_spec.rb +109 -0
  148. data/spec/unit/dopi/step_spec.rb +13 -0
  149. metadata +448 -0
@@ -0,0 +1,35 @@
1
+ name: 'hello_world'
2
+
3
+ credentials:
4
+ 'test-credentials':
5
+ type: 'ssh_key'
6
+ username: 'myuser'
7
+ private_key: '/home/myuser/.ssh/id_rsa'
8
+
9
+ infrastructures:
10
+ 'test':
11
+ type: 'baremetal'
12
+ networks:
13
+ 'localhost':
14
+ ip_pool:
15
+ from: '127.0.0.2'
16
+ to: '127.0.0.250'
17
+ ip_netmask: '255.255.255.0'
18
+ ip_defgw: '127.0.0.1'
19
+
20
+ nodes:
21
+ 'testlinux.example.com':
22
+ infrastructure: 'test'
23
+ interfaces:
24
+ 'eth0':
25
+ network: 'localhost'
26
+ ip: '127.0.0.2'
27
+
28
+ steps:
29
+ - name: 'write hello world'
30
+ nodes: 'all'
31
+ command:
32
+ plugin: 'ssh/custom'
33
+ credentials: 'test-credentials'
34
+ exec: 'echo'
35
+ arguments: '"hello world"'
@@ -0,0 +1,88 @@
1
+ # DOPi Command Plugin: Custom Command
2
+
3
+ This plugin executes custom commands on the the machine DOPi is running on.
4
+
5
+ DOPi will execute a customized command on the node DOPi is running on.
6
+ It will run the command once per node in the step and export the node
7
+ fqdn in the environment variable DOP_NODE_FQDN
8
+
9
+ ## Plugin Settings:
10
+
11
+ ### exec (required)
12
+
13
+ The command the plugin should execute for every node.
14
+
15
+ ### arguments (optional)
16
+
17
+ `default: ""`
18
+
19
+ The arguments for the command. This can be set by a string as an array or
20
+ as a hash. All the elements of the hash and the array will be flattened
21
+ and joined with a space.
22
+
23
+ ### env (optional)
24
+
25
+ `default: { DOP_NODE_FQDN => fqdn_of_node }`
26
+
27
+ The environment variables that should be set. Will be merged with the defalut hash
28
+
29
+ ### expect_exit_codes (optional)
30
+
31
+ `default: 0`
32
+
33
+ The exit codes DOPi should expect if the program terminates. It the program
34
+ exits with an exit code not listed here, DOPi will mark the run as failed.
35
+ The values can be a number, an array of numbers or :all for all possible exit
36
+ codes. Will replace the current default.
37
+
38
+ ### parse_output (optional)
39
+
40
+ `default: {}`
41
+
42
+ Here you can define patterns that match against the output of the command plugin
43
+ and flag certain lines as errors or warnings. The parse_output key should contain
44
+ a hash with two keys, 'error' and 'warning' which each can contain an array of
45
+ patterns.
46
+
47
+ ### fail_on_warning
48
+
49
+ `default: false`
50
+
51
+ Set this to true if you want to threat warnings in the output as errors. This is
52
+ useful if the plugin already specifies the parsing patterns but your need to stop
53
+ the run on warnings.
54
+
55
+ ## Examples:
56
+
57
+ ### Simple Example
58
+
59
+ ```YAML
60
+ - name "Say Hello World on the machine DOPi is running on"
61
+ nodes:
62
+ - 'web01.example.com'
63
+ command:
64
+ plugin: 'custom'
65
+ exec: 'echo'
66
+ arguments: "Hello World from ${DOP_NODE_FQDN}"
67
+ ```
68
+
69
+ ### Complete Example
70
+
71
+ ```YAML
72
+ - name "Install an RPM on the machine DOPi is running on"
73
+ nodes:
74
+ - 'web01.example.com'
75
+ command:
76
+ plugin: 'custom'
77
+ exec: 'yum'
78
+ arguments: 'install -y puppet'
79
+ expect_exit_codes: 0
80
+ fail_on_warning: False
81
+ parse_output:
82
+ error:
83
+ - '^No package puppet available'
84
+ - 'Some other Error pattern'
85
+ warning:
86
+ - '^Warning:'
87
+ ```
88
+
@@ -0,0 +1,82 @@
1
+ # DOPi Command Plugin: MCollective RPC Command
2
+
3
+ This DOPi Plugin will trigger an action of a MCollective agent on the
4
+ nodes in the Step. The plugin can call any agent and any action and will
5
+ mark the step as failed according to the status in the reply.
6
+
7
+ However, do to the generic nature of this plugin it will not be able to
8
+ parse the data structure returned by the agent as this is agent specific.
9
+ Dopi will warn about this when am agent is called with this plugin because
10
+ some errors that are not reflected in the status code may not be caught
11
+ by this plugin.
12
+
13
+ ## Plugin Settings:
14
+
15
+ ### agent (required)
16
+
17
+ The MCollective agent to be called. This agent has to be installed on
18
+ the nodes and the machine DOPi is running on. The DOPi validator will
19
+ check if the agent is present on the machine where you try to run the
20
+ plan.
21
+
22
+ ### action (required)
23
+
24
+ The action we call on the specified agent. Consult the documentation of
25
+ the MCollective agent in question for a list of valid actions. The DOPi
26
+ validator will check if the agent supports such an action and fail if it
27
+ doesn't.
28
+
29
+ ### options (optional)
30
+
31
+ `default: {}`
32
+
33
+ The options hash passed to the MCollective client. Check the output of
34
+ "mco help rpc" to get a list of valid options. However not all of this options
35
+ will make sense in this context. For example, you should never specify a filter
36
+ because DOPi already takes care of that via the node list of the step.
37
+
38
+ ### arguments (optional)
39
+
40
+ `default: {}`
41
+
42
+ The arguments passed to the MCollective agent. Check the agent documentation to
43
+ get a list of required and optional arguments. DOPi will use the validation methods
44
+ provided by MCollective agents and fail the plan validation if the arguments are not
45
+ correct or the values are not valid.
46
+
47
+ ### expect_exit_codes (optional)
48
+
49
+ `default: 0`
50
+
51
+ The exit codes DOPi should expect in the status code returned by the MCollective
52
+ agent. It the status code is an exit code not listed here, DOPi will mark the run
53
+ as failed. The values can be a number, an array of numbers or :all for all possible exit
54
+ codes. Will replace the current default.
55
+
56
+
57
+ ## Examples:
58
+
59
+ ### Simple Example
60
+
61
+ - name "Get the inventory of a node"
62
+ nodes:
63
+ - 'web01.example.com'
64
+ command:
65
+ plugin: 'mco/rpc'
66
+ agent: 'rpcutil'
67
+ action: 'inventory'
68
+
69
+ ### Complete Example
70
+
71
+ - name "Get a fact of a node"
72
+ nodes:
73
+ - 'web01.example.com'
74
+ command:
75
+ plugin: 'mco/rpc'
76
+ agent: 'rpcutil'
77
+ action: 'get_fact'
78
+ arguments:
79
+ :fact: 'osfamily'
80
+ options:
81
+ :timeout: 30
82
+ :ttl: 60
@@ -0,0 +1,141 @@
1
+ # DOPi Command Plugin: Custom SSH Command
2
+
3
+ This plugin executes custom commands on every node in the step over ssh.
4
+
5
+ By default the ssh custom command plugin will skip the host key checks. This
6
+ means you will be potentially vulnerable to man in the middle attacks. Since
7
+ DOPi is designed for the provisioning phase you are working with new nodes and
8
+ this will usually not be an issue, however changing keys because nodes get
9
+ new provisioned will be. To change this set **ssh_check_host_key** to true.
10
+
11
+ ## credentials for login
12
+
13
+ The ssh/custom plugin and all the plugins that inherit from it can use
14
+ credentials from the credentials hash in the plan to login.
15
+
16
+ credentials:
17
+ 'linux_staging_login':
18
+ type: :username_password
19
+ username: 'root'
20
+ password: 'foo'
21
+
22
+ steps:
23
+ - name: 'set ssh login credentials'
24
+ command:
25
+ plugin: 'ssh/custom'
26
+ credentials: 'linux_staging_login'
27
+ exec: 'env'
28
+
29
+ You can also specify multiple credentials and the ssh plugin will try each one
30
+ of them in turn to login to the node.
31
+
32
+ credentials:
33
+ 'linux_staging_login':
34
+ type: :username_password
35
+ username: 'root'
36
+ password: 'foo'
37
+ 'linux_prod_login':
38
+ type: :ssh_key
39
+ private_key: '/home/root/.ssh/id_dsa'
40
+
41
+ steps:
42
+ - name: 'set ssh login credentials'
43
+ command:
44
+ plugin: 'ssh/custom'
45
+ credentials:
46
+ - 'linux_staging_login'
47
+ - 'linux_prod_login'
48
+ exec: 'env'
49
+
50
+ This can be set in each plugin (don't forget the validator plugins) or via
51
+ the set_plugin_defaults hash. The plugin defaults will be preserved for
52
+ subsequent steps until it is altered or deleted.
53
+
54
+ credentials:
55
+ 'linux_staging_login':
56
+ type: :username_password
57
+ username: 'root'
58
+ password: 'foo'
59
+ 'linux_prod_login':
60
+ type: :ssh_key
61
+ private_key: '/home/root/.ssh/id_dsa'
62
+
63
+ steps:
64
+ - name: 'set ssh login credentials'
65
+ set_plugin_defaults:
66
+ - plugins: '/^ssh/'
67
+ :credentials:
68
+ - 'linux_staging_login'
69
+ - 'linux_prod_login'
70
+ command:
71
+ plugin: 'ssh/custom'
72
+ exec: 'env'
73
+
74
+ The login via password will need the program sshpass to be installed on the
75
+ machine DOPi is running on. DOPi will display a warning if you specify a
76
+ username password credential but sshpass is not installed.
77
+
78
+ ## ssh_root_pass auth (DEPRECATED >=0.4)
79
+
80
+ DOPi will connect to the node via ssh and execute the specified command.
81
+ It will use the configured ssh key **(ssh_key)** with the configured user
82
+ **(ssh_user)** unless **ssh_pass_auth** is set and a password for the node
83
+ is configured.
84
+
85
+ The login via password will need the program sshpass to be installed on the
86
+ machine DOPi is running on. The password can be specified as a global option
87
+ in the plan or be overwritten via hieradata.
88
+
89
+ plan:
90
+ ssh_root_pass: 'mypass'
91
+
92
+ configuration:
93
+ node:
94
+ 'web01.example.com':
95
+ ssh_root_pass: 'myotherpass'
96
+
97
+ ## Plugin Settings:
98
+
99
+ The ssh custom command plugin is based on the [custom command plugin](doc/plugins/custom.md)
100
+ and inherits all its parameters.
101
+
102
+ ### quiet (optional)
103
+
104
+ `default: true`
105
+
106
+ By default ssh will run in quiet mode and stuff like login banners will not
107
+ appear in the output. See the documentation about the "-q" flag in the ssh
108
+ man page for more information about this.
109
+
110
+ ### port (optional)
111
+
112
+ `default: 22`
113
+
114
+ The port to which ssh should connect
115
+
116
+ ## Examples:
117
+
118
+ ### Simple Example
119
+
120
+ - name "Say Hello World on a node"
121
+ nodes:
122
+ - 'web01.example.com'
123
+ command:
124
+ plugin: 'ssh/custom'
125
+ exec: 'echo'
126
+ arguments: "Hello World"
127
+
128
+ ### Complete Example
129
+
130
+ - name "Install an RPM on the node"
131
+ nodes:
132
+ - 'web01.example.com'
133
+ command:
134
+ plugin: 'ssh/custom'
135
+ exec: 'yum'
136
+ arguments: 'install -y puppet'
137
+ expect_exit_codes: 0
138
+ fail_on_warning: False
139
+ parse_output:
140
+ error:
141
+ - '^No package puppet available'
@@ -0,0 +1,37 @@
1
+ # DOPi Command Plugin: File Contains SSH Command
2
+
3
+ This DOPi Plugin will check if the specified file on the node contains a
4
+ specific pattern. This plugin is usually used as a verify command to check
5
+ if a command has to be executed on a node.
6
+
7
+ ## Plugin Settings:
8
+
9
+ The ssh/file_contains command plugin is based on the
10
+ [ssh custom command plugin](doc/plugins/ssh/custom.md) and the
11
+ [custom command plugin](doc/plugins/custom.md) and inherits all their
12
+ parameters.
13
+
14
+ It will however overwrite the **exec** parameter, so it is not possible to
15
+ set a custom command in this plugin.
16
+
17
+ ### file (required)
18
+
19
+ The file to check
20
+
21
+ ### pattern (required)
22
+
23
+ The regular expression to check against
24
+
25
+ ## Example:
26
+
27
+ - name "Run puppet on a node"
28
+ nodes:
29
+ - 'web01.example.com'
30
+ command:
31
+ plugin: 'ssh/puppet_agent_run'
32
+ verify_commands:
33
+ - plugin: 'ssh/file_contains'
34
+ file: '/etc/puppet/puppet.conf'
35
+ pattern: 'puppetmaster.example.com'
36
+ arguments:
37
+ '--server': 'puppetmaster.example.com'
@@ -0,0 +1,52 @@
1
+ # DOPi Command Plugin: File Deploy SSH Command
2
+
3
+ This DOPi Plugin will deploy a file to a remote node which can be specified
4
+ inline in the plan or via file or output of an executable.
5
+
6
+ ## Plugin Settings:
7
+
8
+ The ssh/file_deploy command plugin is based on the
9
+ [ssh custom command plugin](doc/plugins/ssh/custom.md) and the
10
+ [custom command plugin](doc/plugins/custom.md) and inherits all their
11
+ parameters.
12
+
13
+ It will however overwrite the **exec** parameter, so it is not possible to
14
+ set a custom command in this plugin.
15
+
16
+ ### file (required)
17
+
18
+ The target file to be deployed
19
+
20
+ ### content (required)
21
+
22
+ The content of the file. This can be specified directly as a string in the
23
+ yaml file or from a file if a hash is specified with a file source.
24
+
25
+ ## Example:
26
+
27
+ - name "Deploy file with inline content"
28
+ nodes:
29
+ - 'web01.example.com'
30
+ command:
31
+ plugin: 'ssh/file_deploy'
32
+ file: '/tmp/resolv.conf'
33
+ content: |
34
+ domain example.com
35
+ nameserver 1.2.3.4
36
+ nameserver 4.3.2.1
37
+
38
+ - name "Deploy file with content from a local file"
39
+ nodes:
40
+ - 'web01.example.com'
41
+ command:
42
+ plugin: 'ssh/file_deploy'
43
+ file: '/tmp/resolv.conf'
44
+ content: { file: './some/local/resolv.conf' }
45
+
46
+ - name "Deploy file with content from a program output"
47
+ nodes:
48
+ - 'web01.example.com'
49
+ command:
50
+ plugin: 'ssh/file_deploy'
51
+ file: '/tmp/resolv.conf'
52
+ content: { exec: ['/bin/exec', 'hello world'] }
@@ -0,0 +1,31 @@
1
+ # DOPi Command Plugin: File Contains SSH Command
2
+
3
+ This DOPi Plugin will check if the specified file on the node exists.
4
+ This plugin is usually used as a verify command to check if a command
5
+ has to be executed on a node.
6
+
7
+ ## Plugin Settings:
8
+
9
+ The ssh/file_exists command plugin is based on the
10
+ [ssh custom command plugin](doc/plugins/ssh/custom.md) and the
11
+ [custom command plugin](doc/plugins/custom.md) and inherits all their
12
+ parameters.
13
+
14
+ It will however overwrite the **exec** parameter, so it is not possible to
15
+ set a custom command in this plugin.
16
+
17
+ ### file (required)
18
+
19
+ The file to check
20
+
21
+ ## Example:
22
+
23
+ - name: 'Install Puppet'
24
+ nodes: all
25
+ command:
26
+ plugin: 'ssh/custom'
27
+ verify_commands:
28
+ - plugin: 'ssh/file_exists'
29
+ file: '/usr/bin/puppet'
30
+ exec: 'yum'
31
+ arguments: 'install -y puppet'
@@ -0,0 +1,37 @@
1
+ # DOPi Command Plugin: File Replace SSH Command
2
+
3
+ This DOPi Plugin to replace a search pattern with a replacement string
4
+ in a file on a node over ssh. This plugin uses sed to replace the string,
5
+ keep that in mind if you define the pattern String.
6
+
7
+ ## Plugin Settings:
8
+
9
+ The ssh/file_replace command plugin is based on the
10
+ [ssh/file_contains](doc/plugins/ssh/file_contains.md),
11
+ [ssh custom command plugin](doc/plugins/ssh/custom.md) and the
12
+ [custom command plugin](doc/plugins/custom.md) and inherits all their
13
+ parameters.
14
+
15
+ It will however overwrite the **exec** parameter, so it is not possible to
16
+ set a custom command in this plugin.
17
+
18
+ ### replacement (required)
19
+
20
+ This the replacement string the that will be substituted for the found pattern.
21
+
22
+ ### global (optional)
23
+
24
+ `default: false`
25
+
26
+ If false it will only replace the first match, if true it will replace them all.
27
+
28
+ ## Example:
29
+
30
+ - name "replace the server in the Puppet config"
31
+ nodes:
32
+ - 'web01.example.com'
33
+ command:
34
+ plugin: 'ssh/file_replace'
35
+ file: '/etc/puppet/puppet.conf'
36
+ pattern: 'puppet.example.com'
37
+ replacement: 'somethingelse.example.com'
@@ -0,0 +1,50 @@
1
+ # DOPi Command Plugin: SSH Puppet Agent run Command
2
+
3
+ This DOPi Plugin will run puppet on the nodes in the step.
4
+
5
+ ## Plugin Settings:
6
+
7
+ The ssh/puppet_agent_run command plugin is based on the
8
+ [ssh custom command plugin](doc/plugins/ssh/custom.md) and the
9
+ [custom command plugin](doc/plugins/custom.md) and inherits all their
10
+ parameters.
11
+
12
+ It will however overwrite the **exec** parameter, so it is not possible to
13
+ set a custom command in this plugin.
14
+
15
+ You may want to set a high **plugin_timeout** here to make sure it waits
16
+ long enough for all the nodes to come up if you provision the nodes while
17
+ waiting.
18
+
19
+ This plugin overwrites the defaults for the **expect_exit_codes** parameter.
20
+ Puppet will return an exit code of 2 if there where changes. Since this will
21
+ be what we are looking we have to expect this and mark it as success
22
+
23
+ `default overwrite for expect_exit_codes : [ 0, 2 ]`
24
+
25
+ If you are sure that there will be changes you should overwrite this with 2
26
+ to make sure there where changes. This may help you catching problems where
27
+ nodes don't actually get a configuration or are in the wrong environment.
28
+
29
+ The ssh/puppet_agent_run plugin has no additional parameters.
30
+
31
+ ## Examples:
32
+
33
+ ### Simple Example
34
+
35
+ - name "Run puppet on a node"
36
+ nodes:
37
+ - 'web01.example.com'
38
+ command: 'ssh/puppet_agent_run'
39
+
40
+ ### Complete Example
41
+
42
+ - name "Run puppet with parameters on a node"
43
+ nodes:
44
+ - 'web01.example.com'
45
+ command:
46
+ plugin: 'ssh/puppet_agent_run'
47
+ plugin_timeout: 300
48
+ arguments:
49
+ '--server': 'puppetmaster.example.com'
50
+ '--environment': 'development'
@@ -0,0 +1,22 @@
1
+ # DOPi Command Plugin: Reboot
2
+
3
+ This plugin will send the reboot command to a node. Then it will check if the
4
+ node actually rebooted by checking until it is unavailable and then available
5
+ again. The command will finish if DOPi is again able to login after the reboot.
6
+
7
+ ## Plugin Settings:
8
+
9
+ ### reboot_cmd (optional)
10
+
11
+ `default: shutdown -r now`
12
+
13
+ The command which gets executed to reboot the machine
14
+
15
+
16
+ ## Example
17
+
18
+ - name "Wait until we can successfully login to the node"
19
+ nodes:
20
+ - 'web01.example.com'
21
+ command: 'ssh/reboot'
22
+
@@ -0,0 +1,53 @@
1
+ # DOPi Command Plugin: Wait for SSH login Command
2
+
3
+ This DOPi Plugin will try to connect to the node until a successful login
4
+ is possible or until a timeout is reached.
5
+
6
+ ## Plugin Settings:
7
+
8
+ The ssh/wait_for_login command plugin is based on the
9
+ [ssh custom command plugin](doc/plugins/ssh/custom.md) and the
10
+ [custom command plugin](doc/plugins/custom.md) and inherits all their
11
+ parameters.
12
+
13
+ It will however overwrite the **exec** parameter, so it is not possible to
14
+ set a custom command in this plugin.
15
+
16
+ You may want to set a high **plugin_timeout** here to make sure it waits
17
+ long enough for all the nodes to come up if you provision the nodes while
18
+ waiting.
19
+
20
+ ### connect_timeout (optional)
21
+
22
+ `default: 0`
23
+
24
+ Amount of seconds to wait while connecting until giving up.
25
+
26
+ ### interval (optional)
27
+
28
+ `default: 10`
29
+
30
+ Amount of seconds to wait between login attempts.
31
+
32
+ ## Examples:
33
+
34
+ ### Simple Example
35
+
36
+ - name "Wait until we can successfully login to the node"
37
+ nodes:
38
+ - 'web01.example.com'
39
+ command:
40
+ plugin: 'ssh/wait_for_login'
41
+ plugin_timeout: 300
42
+
43
+
44
+ ### Complete Example
45
+
46
+ - name "Wait until we can successfully login to the node"
47
+ nodes:
48
+ - 'web01.example.com'
49
+ command:
50
+ plugin: 'ssh/wait_for_login'
51
+ plugin_timeout: 300
52
+ connect_timeout: 5
53
+ interval: 30