brpm_module_ansible 0.0.3 → 0.0.4
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.
- checksums.yaml +8 -8
- data/config.yml +1 -1
- data/lib/ansible.rb +4 -23
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2NiYWE5YmMxMjk2YmJhMjQyNTBhOGJlMDA1Y2E2ZGJhNDkzMGQwNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2Y2ZjQzNjY5OGExNjE4NmNiYTUyOGI1ODMzODhjMGM3OTkxNzJjYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDg1ZDJmN2Y1YWRmMDNjOGUzODZiNzU4NWZhMDdkZGEwYTVmMmYzMmVjODE0
|
10
|
+
ZWM2ZTQyMTY5MzM5OTk3NjdjMmE0ZTE5NTY4MWE1MDk3ZjY3YTAyNWNiMmU5
|
11
|
+
MDA5NWIwY2I2MzdkMjkxYzVlOGI0YTBkYzk4MzRlNzBmZTY4NWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjMxYTVkYWUzZjUxZThlNDJiYmIwOGY2M2RjZmFlNmYyZGM1ZWZiMzRmYWRi
|
14
|
+
MTNmZmY5NDhhNmI0NDkyZDBjOWNiMjQ0ZjFjYWI4N2E1ODNmZjA3MmU3YjEz
|
15
|
+
ZWI3NGRlZmExMTIxYTMzMDkzY2Q0ZGU3ZTk5NGJjNjlkNDZiZGE=
|
data/config.yml
CHANGED
data/lib/ansible.rb
CHANGED
@@ -12,30 +12,11 @@ def execute_ansible_role(role, server_group, ignore_error=false)
|
|
12
12
|
- #{role}
|
13
13
|
EOF
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
complete_command = "su ansib -c \"ansible-playbook #{playbook_file_path}\" 2>&1"
|
19
|
-
|
20
|
-
Logger.log complete_command
|
21
|
-
output = `#{complete_command}`
|
22
|
-
Logger.log "\toutput: #{output}"
|
15
|
+
BrpmAuto.log "Creating playbook.yml..."
|
16
|
+
File.open(playbook_file_path, 'w') {|f| f.write(playbook_content) }
|
23
17
|
|
18
|
+
_, _, stderr, status = BrpmAuto.execute_command "su ansib -c \"ansible-playbook #{playbook_file_path}\""
|
24
19
|
File.delete(playbook_file_path)
|
25
20
|
|
26
|
-
|
27
|
-
unless exit_status == 0
|
28
|
-
message = "The command exited with #{exit_status}."
|
29
|
-
if ignore_error
|
30
|
-
Logger.log "\t#{message}"
|
31
|
-
else
|
32
|
-
raise(message)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
output
|
37
|
-
end
|
38
|
-
|
39
|
-
def execute_ansible_role_and_ignore_error(command)
|
40
|
-
execute_ansible_role(command, true)
|
21
|
+
raise "The command failed with status #{status.exitstatus}.\n#{stderr}" unless status.success? or ignore_error
|
41
22
|
end
|