dopi 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,51 @@
1
+ name: 'test_plugin_ssh_file_contains'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'linux01.example.com':
10
+ infrastructure: 'test'
11
+
12
+ credentials:
13
+ 'linux_login':
14
+ type: 'username_password'
15
+ username: 'root'
16
+ password: 'puppet'
17
+
18
+ steps:
19
+
20
+ - name: "Configure the plugin defaults"
21
+ nodes: 'all'
22
+ set_plugin_defaults:
23
+ - plugins: '/^ssh/'
24
+ credential: 'linux_login'
25
+ command: 'dummy'
26
+
27
+ - name: 'deploy test file'
28
+ nodes: 'all'
29
+ command:
30
+ plugin: 'ssh/custom'
31
+ exec: 'echo'
32
+ arguments: '"Foo" > /tmp/file_contains_test'
33
+
34
+ - name: 'Check if the file contains the string'
35
+ nodes: 'all'
36
+ command:
37
+ verify_commands:
38
+ - plugin: 'ssh/file_contains'
39
+ file: '/tmp/file_contains_test'
40
+ pattern: 'Foo'
41
+ plugin: 'custom'
42
+ exec: 'fail'
43
+
44
+ - name: 'Make sure it returns 1 if the string does not match'
45
+ nodes: 'all'
46
+ command:
47
+ plugin: 'ssh/file_contains'
48
+ file: '/tmp/file_contains_test'
49
+ pattern: 'somethingelse'
50
+ expect_exit_codes: 1
51
+
@@ -0,0 +1,82 @@
1
+ name: 'test_plugin_ssh_file_deploy'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'linux01.example.com':
10
+ infrastructure: 'test'
11
+
12
+ credentials:
13
+ 'linux_login':
14
+ type: 'username_password'
15
+ username: 'root'
16
+ password: 'puppet'
17
+
18
+ steps:
19
+ - name: "Configure the plugin defaults"
20
+ nodes: 'all'
21
+ set_plugin_defaults:
22
+ - plugins: '/^ssh/'
23
+ credential: 'linux_login'
24
+ command: 'dummy'
25
+
26
+ - name: 'Make sure the test files are gone'
27
+ nodes: 'all'
28
+ command:
29
+ plugin: 'ssh/custom'
30
+ exec: 'rm'
31
+ arguments: 'rm -rf /tmp/test_deployed_file*'
32
+
33
+ - name: 'Make sure we can deploy a file with inline content'
34
+ nodes: 'all'
35
+ command:
36
+ verify_commands:
37
+ - plugin: 'ssh/file_exists'
38
+ file: '/tmp/test_deployed_file_inline'
39
+ - plugin: 'ssh/file_contains'
40
+ file: '/tmp/test_deployed_file_inline'
41
+ pattern: 'hello world'
42
+ verify_after_run: true
43
+ plugin: 'ssh/file_deploy'
44
+ file: '/tmp/test_deployed_file_inline'
45
+ content: |
46
+ This is some multiline file
47
+ Deployed from an inline string
48
+ Which contains the sentence
49
+ hello world
50
+ and some other stuff
51
+
52
+ - name: 'Make sure we can deploy a file with content from a file'
53
+ nodes: 'all'
54
+ command:
55
+ verify_commands:
56
+ - plugin: 'ssh/file_exists'
57
+ file: '/tmp/test_deployed_file_file'
58
+ - plugin: 'ssh/file_contains'
59
+ file: '/tmp/test_deployed_file_file'
60
+ pattern: 'hello world'
61
+ verify_after_run: true
62
+ plugin: 'ssh/file_deploy'
63
+ file: '/tmp/test_deployed_file_file'
64
+ content:
65
+ file: 'spec/fixtures/test_deloyed_file.txt'
66
+
67
+ - name: 'Make sure we can deploy a file with content from exec'
68
+ nodes: 'all'
69
+ command:
70
+ verify_commands:
71
+ - plugin: 'ssh/file_exists'
72
+ file: '/tmp/test_deployed_file_exec'
73
+ - plugin: 'ssh/file_contains'
74
+ file: '/tmp/test_deployed_file_exec'
75
+ pattern: 'hello world'
76
+ verify_after_run: true
77
+ plugin: 'ssh/file_deploy'
78
+ file: '/tmp/test_deployed_file_exec'
79
+ content:
80
+ exec: ['/bin/echo', 'hello world']
81
+
82
+
@@ -0,0 +1,69 @@
1
+ name: 'test_plugin_ssh_file_exists'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'linux01.example.com':
10
+ infrastructure: 'test'
11
+
12
+ credentials:
13
+ 'linux_login':
14
+ type: 'username_password'
15
+ username: 'root'
16
+ password: 'puppet'
17
+
18
+ steps:
19
+
20
+ - name: "Configure the plugin defaults"
21
+ nodes: 'all'
22
+ set_plugin_defaults:
23
+ - plugins: '/^ssh/'
24
+ credential: 'linux_login'
25
+ command: 'dummy'
26
+
27
+ #
28
+ # Check if skipping works if the file exists
29
+ #
30
+
31
+ - name: 'Check if the command is skipped if the file does exist'
32
+ nodes: 'all'
33
+ command:
34
+ verify_commands:
35
+ - plugin: 'ssh/file_exists'
36
+ file: '/etc/puppet/puppet.conf'
37
+ plugin: 'custom'
38
+ exec: 'fail'
39
+
40
+ #
41
+ # Check if the command is run if the file does not exists
42
+ #
43
+
44
+ - name: 'Make sure the test file is absent'
45
+ nodes: 'all'
46
+ command:
47
+ plugin: 'ssh/custom'
48
+ exec: 'rm'
49
+ arguments: '-f /tmp/file_exists_test'
50
+
51
+ - name: 'Check if the file is absent an write it again'
52
+ nodes: 'all'
53
+ command:
54
+ verify_commands:
55
+ - plugin: 'ssh/file_exists'
56
+ file: '/tmp/file_exists_test'
57
+ plugin: 'ssh/custom'
58
+ exec: 'echo'
59
+ arguments: '"file_exists test" > /tmp/file_exists_test'
60
+
61
+ - name: 'Check if the file is there and fail if the command is run anyway'
62
+ nodes: 'all'
63
+ command:
64
+ verify_commands:
65
+ - plugin: 'ssh/file_exists'
66
+ file: '/tmp/file_exists_test'
67
+ plugin: 'custom'
68
+ exec: 'fail'
69
+
@@ -0,0 +1,55 @@
1
+ name: 'test_plugin_ssh_file_replace'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'linux01.example.com':
10
+ infrastructure: 'test'
11
+
12
+ credentials:
13
+ 'linux_login':
14
+ type: 'username_password'
15
+ username: 'root'
16
+ password: 'puppet'
17
+
18
+ steps:
19
+ - name: "Configure the plugin defaults"
20
+ nodes: 'all'
21
+ set_plugin_defaults:
22
+ - plugins: '/^ssh/'
23
+ credential: 'linux_login'
24
+ command: 'dummy'
25
+
26
+ - name: 'Replace the server string in puppet.conf'
27
+ nodes: 'all'
28
+ command:
29
+ plugin: 'ssh/file_replace'
30
+ file: '/etc/puppet/puppet.conf'
31
+ pattern: 'puppetmaster.example.com'
32
+ replacement: 'wrong.example.com'
33
+
34
+ - name: 'Check if the String is replaced'
35
+ nodes: 'all'
36
+ command:
37
+ plugin: 'ssh/file_contains'
38
+ file: '/etc/puppet/puppet.conf'
39
+ pattern: 'wrong.example.com'
40
+
41
+ - name: 'Change the String back'
42
+ nodes: 'all'
43
+ command:
44
+ plugin: 'ssh/file_replace'
45
+ file: '/etc/puppet/puppet.conf'
46
+ pattern: 'wrong.example.com'
47
+ replacement: 'puppetmaster.example.com'
48
+
49
+ - name: 'Check if the String is ok again'
50
+ nodes: 'all'
51
+ command:
52
+ plugin: 'ssh/file_contains'
53
+ file: '/etc/puppet/puppet.conf'
54
+ pattern: 'puppetmaster.example.com'
55
+
@@ -0,0 +1,45 @@
1
+ name: 'test_plugin_ssh_puppet_agent_run'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'linux01.example.com':
10
+ infrastructure: 'test'
11
+
12
+ credentials:
13
+ 'linux_login':
14
+ type: 'username_password'
15
+ username: 'root'
16
+ password: 'puppet'
17
+
18
+ steps:
19
+ - name: "Configure the plugin defaults"
20
+ nodes: 'all'
21
+ set_plugin_defaults:
22
+ - plugins: '/^ssh/'
23
+ credential: 'linux_login'
24
+ command: 'dummy'
25
+
26
+ - name: 'Change MCollective config'
27
+ nodes: 'all'
28
+ command:
29
+ plugin: 'ssh/file_replace'
30
+ file: '/etc/mcollective/server.cfg'
31
+ pattern: 'broker.example.com'
32
+ replacement: 'wrong.example.com'
33
+
34
+ - name: 'Puppet Agent run, expect changes'
35
+ nodes: 'all'
36
+ command:
37
+ plugin: 'ssh/puppet_agent_run'
38
+ expect_exit_codes: 2
39
+
40
+ - name: 'Puppet Agent run, expect no changes'
41
+ nodes: 'all'
42
+ command:
43
+ plugin: 'ssh/puppet_agent_run'
44
+ expect_exit_codes: 0
45
+
@@ -0,0 +1,43 @@
1
+ name: 'ssh_reboot_plugin_test'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'linux01.example.com':
10
+ infrastructure: 'test'
11
+ 'linux02.example.com':
12
+ infrastructure: 'test'
13
+ 'linux03.example.com':
14
+ infrastructure: 'test'
15
+
16
+ credentials:
17
+ 'linux_login':
18
+ type: 'username_password'
19
+ username: 'root'
20
+ password: 'puppet'
21
+
22
+ steps:
23
+
24
+ - name: 'Set the credentials'
25
+ nodes: 'all'
26
+ set_plugin_defaults:
27
+ - plugins: '/^ssh/'
28
+ credential: 'linux_login'
29
+ command: 'dummy'
30
+
31
+ - name: 'Rebooot all nodes'
32
+ nodes: 'all'
33
+ exclude_nodes: 'linux01.example.com'
34
+ max_per_role: 1
35
+ commands: 'ssh/reboot'
36
+
37
+ - name: 'Rebooot all nodes'
38
+ nodes: 'linux01.example.com'
39
+ max_per_role: 1
40
+ commands:
41
+ plugin: 'ssh/reboot'
42
+ reboot_cmd: 'reboot'
43
+
@@ -0,0 +1,45 @@
1
+ name: 'ssh_wait_for_login'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'linux01.example.com':
10
+ infrastructure: 'test'
11
+ 'linux02.example.com':
12
+ infrastructure: 'test'
13
+ 'linux03.example.com':
14
+ infrastructure: 'test'
15
+
16
+ credentials:
17
+ 'linux_login':
18
+ type: 'username_password'
19
+ username: 'root'
20
+ password: 'puppet'
21
+
22
+ steps:
23
+
24
+ - name: 'Set the credentials'
25
+ nodes: 'all'
26
+ set_plugin_defaults:
27
+ - plugins: '/^ssh/'
28
+ credential: 'linux_login'
29
+ command: 'dummy'
30
+
31
+ - name: 'reboot all nodes and try to login again'
32
+ nodes: 'all'
33
+ max_in_flight: 2
34
+ commands:
35
+ - 'ssh/wait_for_login'
36
+ - plugin: 'ssh/custom'
37
+ exec: 'shutdown -r now'
38
+ expect_exit_codes: 255
39
+ - 'ssh/wait_for_login'
40
+
41
+ - name: 'make sure we can execute stuff again on all nodes'
42
+ nodes: 'all'
43
+ command:
44
+ plugin: 'ssh/custom'
45
+ exec: 'echo "hello world"'
@@ -0,0 +1,39 @@
1
+ name: 'simple_test_for_winrm_cmd'
2
+ max_in_flight: -1
3
+ canary_host: true
4
+
5
+ infrastructures:
6
+ 'test':
7
+ type: 'baremetal'
8
+
9
+ nodes:
10
+ 'windows01.example.com':
11
+ infrastructure: 'test'
12
+
13
+ credentials:
14
+ 'windows_kerberos':
15
+ type: 'kerberos'
16
+ realm: 'EXAMPLE.COM'
17
+ 'windows_login':
18
+ type: 'username_password'
19
+ username: 'Administrator'
20
+ password: 'vagrant'
21
+
22
+ steps:
23
+ - name: 'execute a simple winrm command'
24
+ nodes: 'all'
25
+ command:
26
+ plugin: 'winrm/cmd'
27
+ credentials:
28
+ - 'windows_kerberos'
29
+ - 'windows_login'
30
+ exec: 'ipconfig'
31
+ arguments: '/all'
32
+
33
+ - name: 'test powershell code'
34
+ nodes: 'all'
35
+ command:
36
+ plugin: 'winrm/powershell'
37
+ credentials: 'windows_login'
38
+ exec: 'Get-NetAdapter'
39
+
@@ -0,0 +1,51 @@
1
+ name: 'test_plugin_ssh_file_contains'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'windows01.example.com':
10
+ infrastructure: 'test'
11
+
12
+ credentials:
13
+ 'windows_login':
14
+ type: 'username_password'
15
+ username: 'administrator'
16
+ password: 'vagrant'
17
+
18
+ steps:
19
+
20
+ - name: "Configure the plugin defaults"
21
+ nodes: 'all'
22
+ set_plugin_defaults:
23
+ - plugins: '/^winrm/'
24
+ credential: 'windows_login'
25
+ command: 'dummy'
26
+
27
+ - name: 'deploy test file'
28
+ nodes: 'all'
29
+ command:
30
+ plugin: 'winrm/cmd'
31
+ exec: 'echo'
32
+ arguments: '"Foo" > C:\Windows\Temp\file_contains_test'
33
+
34
+ - name: 'Check if the file contains the string'
35
+ nodes: 'all'
36
+ command:
37
+ verify_commands:
38
+ - plugin: 'winrm/file_contains'
39
+ file: 'C:\Windows\Temp\file_contains_test'
40
+ pattern: 'Foo'
41
+ plugin: 'custom'
42
+ exec: 'fail'
43
+
44
+ - name: 'Make sure it returns 1 if the string does not match'
45
+ nodes: 'all'
46
+ command:
47
+ plugin: 'winrm/file_contains'
48
+ file: 'C:\Windows\Temp\file_contains_test'
49
+ pattern: 'somethingelse'
50
+ expect_exit_codes: 1
51
+
@@ -0,0 +1,69 @@
1
+ name: 'test_plugin_winrm_file_exists'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'windows01.example.com':
10
+ infrastructure: 'test'
11
+
12
+ credentials:
13
+ 'windows_login':
14
+ type: 'username_password'
15
+ username: 'administrator'
16
+ password: 'vagrant'
17
+
18
+ steps:
19
+
20
+ - name: "Configure the plugin defaults"
21
+ nodes: 'all'
22
+ set_plugin_defaults:
23
+ - plugins: '/^winrm/'
24
+ credential: 'windows_login'
25
+ command: 'dummy'
26
+
27
+ #
28
+ # Check if skipping works if the file exists
29
+ #
30
+
31
+ - name: 'Check if the command is skipped if the file does exist'
32
+ nodes: 'all'
33
+ command:
34
+ verify_commands:
35
+ - plugin: 'winrm/file_exists'
36
+ file: 'C:\Windows\system.ini'
37
+ plugin: 'custom'
38
+ exec: 'fail'
39
+
40
+ #
41
+ # Check if the command is run if the file does not exists
42
+ #
43
+
44
+ - name: 'Make sure the test file is absent'
45
+ nodes: 'all'
46
+ command:
47
+ plugin: 'winrm/cmd'
48
+ exec: 'del'
49
+ arguments: 'C:\Windows\Temp\file_exists_test.txt'
50
+
51
+ - name: 'Check if the file is absent an write it again'
52
+ nodes: 'all'
53
+ command:
54
+ verify_commands:
55
+ - plugin: 'winrm/file_exists'
56
+ file: 'C:\Windows\Temp\file_exists_test.txt'
57
+ plugin: 'winrm/cmd'
58
+ exec: 'echo'
59
+ arguments: '"file_exists test" > C:\Windows\Temp\file_exists_test.txt'
60
+
61
+ - name: 'Check if the file is there and fail if the command is run anyway'
62
+ nodes: 'all'
63
+ command:
64
+ verify_commands:
65
+ - plugin: 'winrm/file_exists'
66
+ file: 'C:\Windows\Temp\file_exists_test.txt'
67
+ plugin: 'custom'
68
+ exec: 'fail'
69
+
@@ -0,0 +1,31 @@
1
+ name: 'winrm_reboot_plugin_test'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'windows01.example.com':
10
+ infrastructure: 'test'
11
+
12
+ credentials:
13
+ 'windows_login':
14
+ type: 'username_password'
15
+ username: 'administrator'
16
+ password: 'vagrant'
17
+
18
+ steps:
19
+
20
+ - name: "Configure the plugin defaults"
21
+ nodes: 'all'
22
+ set_plugin_defaults:
23
+ - plugins: '/^winrm/'
24
+ credential: 'windows_login'
25
+ command: 'dummy'
26
+
27
+ - name: 'Rebooot all nodes'
28
+ nodes: 'all'
29
+ max_per_role: 1
30
+ commands: 'winrm/reboot'
31
+
@@ -0,0 +1,23 @@
1
+ name: 'resolve_roles_on_validate'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'linux01.example.com':
10
+ infrastructure: 'test'
11
+
12
+ configuration:
13
+ nodes:
14
+ 'linux01.example.com':
15
+ role: 'testrole'
16
+
17
+ steps:
18
+
19
+ - name: 'Step which includes only one role'
20
+ roles:
21
+ - 'testrole'
22
+ command:
23
+ plugin: 'dummy'
@@ -0,0 +1,37 @@
1
+ name: 'test_ssh_in_parallel'
2
+ max_in_flight: -1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'linux01.example.com':
10
+ infrastructure: 'test'
11
+ 'linux02.example.com':
12
+ infrastructure: 'test'
13
+ 'linux03.example.com':
14
+ infrastructure: 'test'
15
+
16
+ credentials:
17
+ 'linux_login':
18
+ type: 'username_password'
19
+ username: 'root'
20
+ password: 'puppet'
21
+
22
+ steps:
23
+
24
+ - name: 'Wait until you are able to connect'
25
+ nodes: 'all'
26
+ command:
27
+ plugin: 'ssh/wait_for_login'
28
+ credentials: 'linux_login'
29
+
30
+ - name: 'Execute a command on multiple nodes'
31
+ nodes: 'all'
32
+ command:
33
+ plugin: 'ssh/custom'
34
+ credentials: 'linux_login'
35
+ exec: 'sleep'
36
+ arguments: '5'
37
+
@@ -0,0 +1,49 @@
1
+ name: 'verify_command_tests'
2
+ max_in_flight: 1
3
+
4
+ infrastructures:
5
+ 'test':
6
+ type: 'baremetal'
7
+
8
+ nodes:
9
+ 'linux01.example.com':
10
+ infrastructure: 'test'
11
+
12
+ credentials:
13
+ 'linux_login':
14
+ type: 'username_password'
15
+ username: 'root'
16
+ password: 'puppet'
17
+
18
+ steps:
19
+ - name: 'Remove the test file'
20
+ nodes: 'all'
21
+ set_plugin_defaults:
22
+ - plugins: '/^ssh/'
23
+ credential: 'linux_login'
24
+ command:
25
+ plugin: 'ssh/custom'
26
+ exec: 'rm'
27
+ arguments: '-rf /tmp/verify_command_test'
28
+
29
+ - name: 'write the test file'
30
+ nodes: 'all'
31
+ command:
32
+ verify_commands:
33
+ - plugin: 'ssh/file_exists'
34
+ file: '/tmp/verify_command_test'
35
+ verify_after_run: true
36
+ plugin: 'ssh/custom'
37
+ exec: 'echo'
38
+ arguments: '"Verify command test" > /tmp/verify_command_test'
39
+
40
+ - name: 'Fail if contents of the file is wrong'
41
+ nodes: 'all'
42
+ command:
43
+ verify_commands:
44
+ - plugin: 'ssh/file_contains'
45
+ file: '/tmp/verify_command_test'
46
+ pattern: '^Verify command test$'
47
+ plugin: 'ssh/custom'
48
+ exec: 'fail'
49
+