Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-library/pull/19#discussion_r56029215
--- Diff:
software/cm/ansible/src/main/java/org/apache/brooklyn/entity/cm/ansible/AnsiblePlaybookTasks.java
---
@@ -105,5 +107,27 @@ private static String
optionalExtraVarsParameter(Object extraVars) {
}
return " --extra-vars \"@" + EXTRA_VARS_FILENAME + "\" ";
}
+
+ public static TaskFactory<?> setUpHostsFile(String installDir, boolean
force) {
+ final String hostsFile = "/etc/ansible/hosts";
+ final String tempFile = "/tmp/hosts";
+ String checkInstalled = !force ? "which ansible || " : "";
+ return sshCommands(
+ checkInstalled + " {",
+ sudo("rm -f " + hostsFile),
+ "echo 'localhost ansible_connection=local' > " + tempFile,
--- End diff --
Could send this directly to `/etc/ansible/hosts`. Should be atomic? Then
the wrapper block won't be needed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---