Rundeck通过REST API控制Proxmox [英] Rundeck controlling Proxmox through REST API

查看:65
本文介绍了Rundeck通过REST API控制Proxmox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对与Docker一起安装的Rundeck完全陌生.我的目标是使用其API控制Proxmox集群.我怎样才能做到这一点?也许和Ansible在一起?你有指针给我吗?

I'm completely new to Rundeck, which I installed with Docker. My goal is to control a Proxmox cluster with its APIs. How can I do that? Maybe with Ansible? Do you have pointers for me?

预先感谢

致谢

推荐答案

Ansible并非必需.您可以使用 HTTP工作流程步骤插件以发送

Ansible isn't necessary for that. You can create a workflow with HTTP Workflow step plugin to send the API request to your Proxmox host (download the jar file from here and put it on the libext directory or use the plugin manager to install it [ Gear icon > Plugins > Find Plugins > Search "HTTP Workflow Step" and click on "Install" button ], you don't need to restart the instance).

或者,您可以使用创建工作流程脚本步骤,Proxmox API会直接使用 cURL 进行调用.另外,您可以动态地将选项传递给脚本使用 @ option.myoption @ 语法的步骤(例如,从选项列表传递操作).

Alternatively, you can create a workflow with a script-step that the Proxmox API call using cURL directly. Also, you can pass options dynamically to your script step using @option.myoption@ syntax (for example, pass the actions from an options list).

我留下了两种定义工作的示例(使用 httpbin.org 服务并传递了几个这两个步骤的选项).

I leave a job definition example with both ways to do this (using httpbin.org service and passing a couple of options to both steps).

<joblist>
  <job>
    <context>
      <options preserveOrder='true'>
        <option name='action' value='anything' />
        <option name='host' value='httpbin.org' />
      </options>
    </context>
    <defaultTab>nodes</defaultTab>
    <description></description>
    <executionEnabled>true</executionEnabled>
    <id>da60f0f8-d3d1-4f6d-b01e-704e00fa2ae8</id>
    <loglevel>INFO</loglevel>
    <name>APICallExample</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <plugins />
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <description>Example using http workflow step plugin</description>
        <step-plugin type='edu.ohio.ais.rundeck.HttpWorkflowStepPlugin'>
          <configuration>
            <entry key='authentication' value='None' />
            <entry key='checkResponseCode' value='true' />
            <entry key='headers' value='{"Accept": "application/json"}' />
            <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://${option.host}/${option.action}' />
            <entry key='responseCode' value='200' />
            <entry key='sslVerify' value='false' />
            <entry key='timeout' value='30000' />
          </configuration>
        </step-plugin>
      </command>
      <command>
        <description>Example using script-step</description>
        <fileExtension>.sh</fileExtension>
        <script><![CDATA[curl -X POST "https://@option.host@/@option.action@" -H  "accept: application/json"]]></script>
        <scriptargs />
        <scriptinterpreter>/bin/bash</scriptinterpreter>
      </command>
    </sequence>
    <uuid>da60f0f8-d3d1-4f6d-b01e-704e00fa2ae8</uuid>
  </job>
</joblist>

这篇关于Rundeck通过REST API控制Proxmox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆