Coder Social home page Coder Social logo

Comments (6)

resmo avatar resmo commented on June 30, 2024

Hi @timdiggins

In terms of idempotency, enable_vpc/enable_vpc2 is tricky for the following reasons:

  1. users have no control over the IP subnet and CIDR
  2. if a user ever wants to have a 2nd VPC, it would no longer work

Therefore, our suggestion is to define a VPC as follows:

- name: Ensure a VPC is present
  vultr.cloud.vpc:
    description: default
    subnet: 10.99.1.0
    subnet_mask: 24
    region: ams

- name: Create an instance using OS
  vultr.cloud.instance:
    label: web1
    hostname: my-hostname
    os: Debian 12 x64 (bookworm)
    firewall_group: my firewall group
    plan: vc2-1c-2gb
    ssh_keys:
      - my ssh key
    vpcs:
      - default
    region: ams

Would this be an option?

P.s. As an inspiration, you might want to look at https://github.com/ngine-io/ansible-vultr-demo

from ansible-collection-vultr.

timdiggins avatar timdiggins commented on June 30, 2024

@resmo - thanks that's very helpful!

I can see your points, and this does the same thing with better idempotency.
But also by adapting the name to be specific to the cluster I'm setting up then have isolation between eg. staging and production clusters (and more straightforward destruction if needed - not sure if one should clean up the vpc for temporary clusters (e.g. staging), but i guess best practice)

from ansible-collection-vultr.

timdiggins avatar timdiggins commented on June 30, 2024

(Closing this - useful to have around as docs)

from ansible-collection-vultr.

timdiggins avatar timdiggins commented on June 30, 2024

@resmo sorry one more question: which parameters governs identity (and thus idempotency) in the vpc module? Is it description + region?

It might help to have some documentation of this in the vpc module. (particularly asdescription (rather than name) doesn't sound like a label for an identity parameter)

from ansible-collection-vultr.

resmo avatar resmo commented on June 30, 2024

it's description (or name as it is an alias https://docs.ansible.com/ansible/latest/collections/vultr/cloud/vpc_module.html#parameter-description) only. But I see it would make sense to probably also take the region into account. This would allow to have similar "names" in many regions.

from ansible-collection-vultr.

resmo avatar resmo commented on June 30, 2024

Closing this as #98 has been merged.

from ansible-collection-vultr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.