Mixing Ansbile linode v3 and v4 apis?

It looks like the v3 API is deprecated, but the new(ish) v4 api in the Ansible module doesn't seem to have the full capabilities to add extra features, like private ips, work with node balancers, etc.

Can I use the v4 api to spin up a linode or two, then fall back to the v3 API using the ID from the v4 setup, to make v3 api calls?

Has anyone got a playbook showing this? Or am I asking for too much?

3 Replies

Well, it doesn't look like I can do this, but I have figured out an ugly ugly ugly workaround using the 'linode-cli' to actually create the node balancer I want, which is good.


Create the nodebalancer config using the linode-cli tools

  • name: Create nodebalancer
    local_action:
    command:
    cmd: "linode-cli nodebalancer create --json --region {{ region >}} --label {{ nb_label }}"
    register: my_nb

  • name: Show Nodebalancer
    local_action:
    module: debug
    msg="NBID={{ my_nb.id }}"

But I'm still testing this. It would be so much nicer if the linode_v4 api supported this directly.

I'm not an expert in the Linode API (v4)…and I don't play one on tee-vee. That being said, from your OP and reply, it seems like this is what you want:

https://www.linode.com/docs/api/nodebalancers/#nodebalancer-create

-- sw

Sorry, I was talking more about the Ansible_v4 module, which doesn't support the Nodebalancers command. As I see it, it looks like I need to call the linode-cli command from Ansible and do my own parsing and such.

Or extend the existing Ansible module to support the nodebalancers API. I'm just amazed it hasn't been done yet by someone, or even someone at Linode, since I would think this would be a great way to get uptake of their services.

Yet more hacking… but anyone who has good examples of using the linode-cli with Ansible directly, I encourage you to post what you have please!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct