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

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

问题描述

我对 Rundeck 完全陌生,我用 Docker 安装了它.我的目标是使用其 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 工作流程步骤 插件发送API 请求到您的 Proxmox 主机 (从这里下载 jar 文件和把它放在libext目录或使用插件管理器安装它[齿轮图标>插件>查找插件>搜索>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 调用的脚本步骤.此外,您可以将 options 动态传递给您的脚本使用 @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天全站免登陆