Skip to content

Commit

Permalink
remove hostname property
Browse files Browse the repository at this point in the history
  • Loading branch information
dangel101 authored and mwperina committed Aug 4, 2022
1 parent 6964632 commit 6dc9bf8
Showing 1 changed file with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class AnsibleCommandConfig implements LogFileConfig, PlaybookConfig {
public static final String ANSIBLE_EXECUTION_METHOD = "start";

private String cluster;
private String hostname;
private VDS host;
private Map<String, Object> variables;
private String variableFilePath;
Expand Down Expand Up @@ -103,10 +102,6 @@ public String playbook() {
return playbook;
}

public String hostname() {
return this.hostname;
}

public String cluster() {
return cluster;
}
Expand Down Expand Up @@ -183,7 +178,6 @@ public AnsibleCommandConfig cluster(String cluster) {
}

public AnsibleCommandConfig host(VDS host) {
this.hostname = host.getHostName();
this.host = host;
return this;
}
Expand Down Expand Up @@ -302,16 +296,14 @@ private File setupAnsibleRunnerExecutionDir() throws IOException {

private void createHostFile(File inventory) {
File hostFile = new File(String.format("%1$s/hosts", inventory));
if (!hostname.isEmpty()) {
try {
hostFile.createNewFile();
Files.write(hostFile.toPath(),
String.format(this.hostname + " ansible_port=%1$s", this.host.getSshPort()).getBytes());
} catch (IOException ex) {
throw new AnsibleRunnerCallException(
String.format("Failed to create inventory file '%s':", hostFile.toString()),
ex);
}
try {
hostFile.createNewFile();
Files.write(hostFile.toPath(),
String.format(this.host.getHostName() + " ansible_port=%1$s", this.host.getSshPort()).getBytes());
} catch (IOException ex) {
throw new AnsibleRunnerCallException(
String.format("Failed to create inventory file '%s':", hostFile.toString()),
ex);
}
}

Expand Down

0 comments on commit 6dc9bf8

Please sign in to comment.