Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rundeck job file extension #169

Open
jodygilbert opened this issue Feb 16, 2025 · 0 comments
Open

rundeck job file extension #169

jodygilbert opened this issue Feb 16, 2025 · 0 comments

Comments

@jodygilbert
Copy link

jodygilbert commented Feb 16, 2025

This issue was raised previously under issue #116 and incorrectly closed.

We are using rundeck to execute PowerShell scripts as inline script, configuring this via the GUI is simple enough as you can add a file extension of ps1. However, the terraform provider doesn't support the file extension, which means the script is copied to the remote server with the default file extension of .bat, which PowerShell executes as a batch file rather than PowerShell.

Can the file extension option be included in the script_interpreter block? As example is below:

resource "rundeck_job" "powershell_lab" {
  name = "Run powershell script on server"
  project_name = rundeck_project.windows_lab.name
  node_filter_query = "tags:running"
  description = "Windows Powershell Script job"

  command {
    description = "Execute Powershell script"
    inline_script = file("${path.module}/scripts/powershell_lab.ps1")
    script_interpreter {
      file_extension = "ps1"
      invocation_string = "powershell.exe $${scriptfile}"
    }
  }
}

As a workaround with PowerShell, you can use the following for the invocation string:

powershell.exe -NoProfile -NoLogo -Command {Invoke-Expression -Command (Get-Content -path $${scriptfile} -Raw)}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant