Coder Social home page Coder Social logo

Comments (3)

89luca89 avatar 89luca89 commented on May 27, 2024
all:
  hosts:
    terraform_node:
      ansible_host: localhost
      ansible_connection: local
    hypervisor_1:
      terraform_target_hypervisor: thinkpad-w540.lan
      terraform_target_hypervisor_user: root
      terraform_target_hypervisor_port: 22
      terraform_target_hypervisor_password: password
    hypervisor_2:
      terraform_target_hypervisor: 10.90.20.12
      terraform_target_hypervisor_user: root
      terraform_target_hypervisor_port: 22
      terraform_target_hypervisor_password: password
  children:
    deploy:
      vars:
        disk_source: "/var/lib/libvirt/images/_Centos-8-template.qcow2"
        os_family: RedHat
        pool_name: default
        ssh_password: root
        ssh_port: 22
        ssh_user: root
        ssh_public_key_file: '~/.ssh/id_rsa.pub'
        set_new_password: password123
      children:
        master_nodes:
          hosts:
            master-node-0:
              os_family: FreeBSD
              disk_source: "/var/lib/libvirt/images/_freebsd-terraform.qcow2"
              cpu: 2
              memory: 1024
              ansible_host: 192.168.122.200
              hypervisor: hypervisor_1
              network_interfaces:
                if-0:
                  name: default
                  ip: 192.168.122.200
                  gw: 192.168.122.1
                  mac_address: "AA:BB:CC:11:24:67"
                  type: nat
                  dns:
                    - 192.168.122.1
                if-1:
                  name: enp0s25
                  ip: 192.168.100.200
                  gw: 192.168.100.1
                  mac_address: "AA:BB:CC:11:25:67"
                  type: macvtap
                  default_route: True
                  dns:
                    - 192.168.100.1
        slave_nodes:
          hosts:
            slave-node-0:
              os_family: Debian
              disk_source: "/var/lib/libvirt/images/_debian10-terraform.qcow2"
              cpu: 1
              memory: 512
              hypervisor: hypervisor_2
              ansible_host: 192.168.122.201
              network_interfaces:
                if-0:
                  name: default
                  ip: 192.168.122.201
                  gw: 192.168.122.1
                  mac_address: "AA:BB:CC:11:24:68"
                  type: nat
                  dns:
                    - 192.168.122.1
                if-1:
                  name: enp0s25
                  ip: 192.168.100.201
                  gw: 192.168.100.1
                  type: macvtap
                  default_route: True
                  dns:
                    - 192.168.100.1
                if-2:
                  name: enp0s25
                  ip: 192.168.100.211
                  gw: 192.168.100.1
                  type: macvtap
                  dns:
                    - 192.168.100.1

This is a first approach of the idea, shift all the VMs in the group deploy (that will be used as hosts in main.yml), specify hypervisors and terraform_nodes as hosts outside of this group.

Link each VM to his own hypervisor, and let the setup_vars.yml task set the various inferences based on this.

main.yml:

- hosts: deploy
  gather_facts: False
  max_fail_percentage: 0
  roles:
    - terraform

from terrible.

89luca89 avatar 89luca89 commented on May 27, 2024

Initial work on multi-hypervisor
move node's hypervisor membership from group definition to variable
definition.
Hypervisors are now hosts (not included in the run) and affinity is
defined on per-VM level.

from terrible.

89luca89 avatar 89luca89 commented on May 27, 2024

We will move in the direction of removing custom variables like terraform_target_hypervisor and simply use the ansible_host variables for hypervisors.

This will not only simplify documentation and setup (less custom variables, more standard values), but will initialize the work needed for #34

from terrible.

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.