in app/models/packer/PackerProvisionerConfig.scala [26:53]
def fileCopy(source: Path, destination: String) = PackerProvisionerConfig(
`type` = "file",
source = Some(source.toAbsolutePath.toString),
destination = Some(destination)
)
def executeRemoteScript(script: String) = PackerProvisionerConfig(
`type` = "shell",
script = Some(script),
execute_command = Some("{{ .Vars }} sudo -E bash -x '{{ .Path }}'")
)
def executeRemoteCommands(commands: Seq[String]) = PackerProvisionerConfig(
`type` = "shell",
inline = Some(commands),
execute_command = Some("{{ .Vars }} sudo -E bash -x '{{ .Path }}'")
)
def ansibleLocal(playbookFile: Path, rolesDir: Path) = {
val rolePaths =
Files.list(rolesDir).iterator.asScala.toSeq.map(_.toAbsolutePath.toString)
PackerProvisionerConfig(
`type` = "ansible-local",
extra_arguments = Some(Seq("--verbose")),
playbook_file = Some(playbookFile.toAbsolutePath.toString),
role_paths = Some(rolePaths)
)
}