dopi 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +322 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +102 -0
- data/LICENSE.txt +177 -0
- data/README.md +309 -0
- data/Rakefile +44 -0
- data/Vagrantfile +64 -0
- data/bin/dopi +4 -0
- data/doc/getting_started.md +247 -0
- data/doc/getting_started_examples/001_hello_world.yaml +17 -0
- data/doc/getting_started_examples/002_connecting_over_ssh.yaml +35 -0
- data/doc/plugins/custom.md +88 -0
- data/doc/plugins/mco/rpc.md +82 -0
- data/doc/plugins/ssh/custom.md +141 -0
- data/doc/plugins/ssh/file_contains.md +37 -0
- data/doc/plugins/ssh/file_deploy.md +52 -0
- data/doc/plugins/ssh/file_exists.md +31 -0
- data/doc/plugins/ssh/file_replace.md +37 -0
- data/doc/plugins/ssh/puppet_agent_run.md +50 -0
- data/doc/plugins/ssh/reboot.md +22 -0
- data/doc/plugins/ssh/wait_for_login.md +53 -0
- data/doc/plugins/winrm/cmd.md +161 -0
- data/doc/plugins/winrm/file_contains.md +39 -0
- data/doc/plugins/winrm/file_exists.md +31 -0
- data/doc/plugins/winrm/powershell.md +27 -0
- data/doc/plugins/winrm/puppet_agent_run.md +49 -0
- data/doc/plugins/winrm/reboot.md +17 -0
- data/doc/plugins/winrm/wait_for_login.md +55 -0
- data/dopi.gemspec +42 -0
- data/lib/dopi/cli/command_add.rb +35 -0
- data/lib/dopi/cli/command_list.rb +19 -0
- data/lib/dopi/cli/command_remove.rb +31 -0
- data/lib/dopi/cli/command_reset.rb +27 -0
- data/lib/dopi/cli/command_run.rb +68 -0
- data/lib/dopi/cli/command_show.rb +109 -0
- data/lib/dopi/cli/command_update.rb +37 -0
- data/lib/dopi/cli/command_validate.rb +27 -0
- data/lib/dopi/cli/global_options.rb +55 -0
- data/lib/dopi/cli/log.rb +33 -0
- data/lib/dopi/cli.rb +57 -0
- data/lib/dopi/command/custom.rb +52 -0
- data/lib/dopi/command/dummy.rb +27 -0
- data/lib/dopi/command/mco/rpc.rb +158 -0
- data/lib/dopi/command/ssh/custom.rb +48 -0
- data/lib/dopi/command/ssh/file_contains.rb +70 -0
- data/lib/dopi/command/ssh/file_deploy.rb +71 -0
- data/lib/dopi/command/ssh/file_exists.rb +54 -0
- data/lib/dopi/command/ssh/file_replace.rb +96 -0
- data/lib/dopi/command/ssh/puppet_agent_run.rb +63 -0
- data/lib/dopi/command/ssh/reboot.rb +50 -0
- data/lib/dopi/command/ssh/wait_for_login.rb +68 -0
- data/lib/dopi/command/winrm/cmd.rb +44 -0
- data/lib/dopi/command/winrm/file_contains.rb +66 -0
- data/lib/dopi/command/winrm/file_exists.rb +51 -0
- data/lib/dopi/command/winrm/powershell.rb +16 -0
- data/lib/dopi/command/winrm/puppet_agent_run.rb +61 -0
- data/lib/dopi/command/winrm/reboot.rb +33 -0
- data/lib/dopi/command/winrm/wait_for_login.rb +49 -0
- data/lib/dopi/command.rb +239 -0
- data/lib/dopi/command_parser/arguments.rb +38 -0
- data/lib/dopi/command_parser/credentials.rb +59 -0
- data/lib/dopi/command_parser/env.rb +37 -0
- data/lib/dopi/command_parser/exec.rb +27 -0
- data/lib/dopi/command_parser/exit_code.rb +73 -0
- data/lib/dopi/command_parser/output.rb +126 -0
- data/lib/dopi/command_set.rb +66 -0
- data/lib/dopi/connector/local.rb +77 -0
- data/lib/dopi/connector/ssh.rb +170 -0
- data/lib/dopi/connector/winrm.rb +167 -0
- data/lib/dopi/error.rb +43 -0
- data/lib/dopi/log.rb +18 -0
- data/lib/dopi/node.rb +70 -0
- data/lib/dopi/plan.rb +99 -0
- data/lib/dopi/pluginmanager.rb +62 -0
- data/lib/dopi/state.rb +226 -0
- data/lib/dopi/state_store.rb +155 -0
- data/lib/dopi/step.rb +227 -0
- data/lib/dopi/step_set.rb +70 -0
- data/lib/dopi/version.rb +3 -0
- data/lib/dopi.rb +165 -0
- data/spec/command_helper.rb +11 -0
- data/spec/fixtures/mco_client.cfg +26 -0
- data/spec/fixtures/plans/fail_on_timeout.yaml +20 -0
- data/spec/fixtures/plans/hello_world.yaml +34 -0
- data/spec/fixtures/plans/non_existing_node.yaml +26 -0
- data/spec/fixtures/plans/test_role_variable.yaml +29 -0
- data/spec/fixtures/puppet/Puppetfile +8 -0
- data/spec/fixtures/puppet/Puppetfile.lock +57 -0
- data/spec/fixtures/puppet/hiera.yaml +6 -0
- data/spec/fixtures/puppet/manifests/site.pp +52 -0
- data/spec/fixtures/test_configuration.yaml +54 -0
- data/spec/fixtures/test_credentials.yaml +11 -0
- data/spec/fixtures/test_deloyed_file.txt +5 -0
- data/spec/fixtures/test_infrastructure.yaml +12 -0
- data/spec/fixtures/test_nodes.yaml +45 -0
- data/spec/fixtures/testenv_plan.yaml +159 -0
- data/spec/integration/dopi/addrun_spec.rb +31 -0
- data/spec/integration/dopi/cli/command_run_spec.rb +38 -0
- data/spec/integration/dopi/cli/global_options_spec.rb +128 -0
- data/spec/integration/dopi/command_spec.rb +66 -0
- data/spec/integration/dopi/fail_check_plans/file_exists_fails.yaml +38 -0
- data/spec/integration/dopi/fail_check_plans/output_parser.yaml +39 -0
- data/spec/integration/dopi/fail_check_plans/powershell_fail.yaml +25 -0
- data/spec/integration/dopi/fail_check_plans/timeout.yaml +29 -0
- data/spec/integration/dopi/fail_check_plans/verify_commands.yaml +33 -0
- data/spec/integration/dopi/failplan.rb +27 -0
- data/spec/integration/dopi/plan.rb +27 -0
- data/spec/integration/dopi/plans/dummy.yaml +29 -0
- data/spec/integration/dopi/plans/max_per_role.yaml +55 -0
- data/spec/integration/dopi/plans/no_timeout.yaml +29 -0
- data/spec/integration/dopi/plans/node_and_role_patterns.yaml +58 -0
- data/spec/integration/dopi/plans/node_by_config.yaml +116 -0
- data/spec/integration/dopi/plans/plugin_defaults.yaml +86 -0
- data/spec/integration/dopi/plans/plugins/mco/rpc.yaml +33 -0
- data/spec/integration/dopi/plans/plugins/ssh/custom.yaml +97 -0
- data/spec/integration/dopi/plans/plugins/ssh/file_contains.yaml +51 -0
- data/spec/integration/dopi/plans/plugins/ssh/file_deploy.yaml +82 -0
- data/spec/integration/dopi/plans/plugins/ssh/file_exists.yaml +69 -0
- data/spec/integration/dopi/plans/plugins/ssh/file_replace.yaml +55 -0
- data/spec/integration/dopi/plans/plugins/ssh/puppet_agent_run.yaml +45 -0
- data/spec/integration/dopi/plans/plugins/ssh/reboot.yaml +43 -0
- data/spec/integration/dopi/plans/plugins/ssh/wait_for_login.yaml +45 -0
- data/spec/integration/dopi/plans/plugins/winrm/cmd.yaml +39 -0
- data/spec/integration/dopi/plans/plugins/winrm/file_contains.yaml +51 -0
- data/spec/integration/dopi/plans/plugins/winrm/file_exists.yaml +69 -0
- data/spec/integration/dopi/plans/plugins/winrm/reboot.yaml +31 -0
- data/spec/integration/dopi/plans/resolve_roles_on_validate.yaml +23 -0
- data/spec/integration/dopi/plans/ssh_parallel.yaml +37 -0
- data/spec/integration/dopi/plans/verify_commands.yaml +49 -0
- data/spec/spec_helper.rb +104 -0
- data/spec/unit/dopi/command/custom_spec.rb +58 -0
- data/spec/unit/dopi/command/mco/rpc_spec.rb +157 -0
- data/spec/unit/dopi/command/ssh/custom_spec.rb +30 -0
- data/spec/unit/dopi/command/ssh/file_deploy_spec.rb +42 -0
- data/spec/unit/dopi/command/ssh/file_replace_spec.rb +35 -0
- data/spec/unit/dopi/command_parser/credentials_spec.rb +53 -0
- data/spec/unit/dopi/command_parser/exit_code_spec.rb +63 -0
- data/spec/unit/dopi/command_parser/output_spec.rb +129 -0
- data/spec/unit/dopi/command_spec.rb +14 -0
- data/spec/unit/dopi/connector/winrm_spec.rb +111 -0
- data/spec/unit/dopi/node_spec.rb +24 -0
- data/spec/unit/dopi/plan_spec.rb +31 -0
- data/spec/unit/dopi/state_spec.rb +109 -0
- data/spec/unit/dopi/step_spec.rb +13 -0
- 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
|
+
|