如何解决如何在Rundeck中创建触发REST URL的作业?
有一个REST端点正在执行一些自动化工作。我需要从Rundeck作为作业运行它。是否可以这样做。
解决方法
例如,可以肯定的是,您可以使用HTTP Workflow Step Plugin插件以cURL的相同方式调用任何API REST URL。或直接调用(在命令步骤或内联脚本/脚本步骤上使用cURL)。
我留下了这个使用httpbin测试服务的工作定义示例(使用HTTP Workflow Step插件方式):
<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>f953870e-efbb-4144-bea4-7432c4733710</id>
<loglevel>INFO</loglevel>
<name>HelloWorld</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<step-plugin type='edu.ohio.ais.rundeck.HttpWorkflowStepPlugin'>
<configuration>
<entry key='authentication' value='None' />
<entry key='checkResponseCode' value='false' />
<entry key='method' value='POST' />
<entry key='printResponse' value='true' />
<entry key='printResponseToFile' value='false' />
<entry key='proxySettings' value='false' />
<entry key='remoteUrl' value='https://httpbin.org/anything' />
<entry key='sslVerify' value='false' />
<entry key='timeout' value='30000' />
</configuration>
</step-plugin>
</command>
</sequence>
<uuid>f953870e-efbb-4144-bea4-7432c4733710</uuid>
</job>
</joblist>
同一件事,但使用脚本步骤:
<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>908fae13-1282-4584-b8bf-2f626c605cfe</id>
<loglevel>INFO</loglevel>
<name>HelloWorld</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<fileExtension>.sh</fileExtension>
<script><![CDATA[curl -s -X POST "https://httpbin.org/anything" -H "accept: application/json"]]></script>
<scriptargs />
<scriptinterpreter>/bin/sh</scriptinterpreter>
</command>
</sequence>
<uuid>908fae13-1282-4584-b8bf-2f626c605cfe</uuid>
</job>
</joblist>
然后here结果。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。