Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVEMENT] Improve inventory defaults #91

Open
89luca89 opened this issue Jul 5, 2021 · 0 comments
Open

[IMPROVEMENT] Improve inventory defaults #91

89luca89 opened this issue Jul 5, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request experimental This issue needs a deep research and some improvement evaluation help wanted Extra attention is needed refactoring Improve the code readability changing nomenclature and/or some other things
Milestone

Comments

@89luca89
Copy link
Owner

89luca89 commented Jul 5, 2021

Right now, setting up a VM can be quite a bit of YAML code, so we should improve this giving better and sane defaults for all aspects of a VM

Right now we could improve setting up:

  1. if only 1 network is defined, it's default_route by default
  2. if only 1 network is defined, DNS and Gateway will default to xxx.xxx.xxx.1
  3. if only 1 network is defined, IP should default to ansible_host
  4. if a disk is declared, it will default to the first FStype (ext4, ufs, etc...)
  5. if a disk is declared, it will default mount to /mnt/${ disk name }
  6. if a disk is declared, it will default to the pool_name
  7. if a disk is declared, and it's a swap it should default mount_point to none without having to declare it
  8. pool_name should default to default
  9. if only 1 hypervisor is declared, VMs should default to it.

Ideally a simple inventory without many variables should be able to declare VMs in a simple manner like:

all:
  vars:
     disk_source: "/mnt/template.qcow2"
     os_family: RedHat
  hosts:
    terraform_node:
      ansible_host: localhost
      ansible_connection: local
    hypervisor_1:
      ansible_host: 10.90.20.12
      ansible_user: root
  children:
    deploy:
      children:
        my_nodes:
          hosts:
            node-0:
              cpu: 2
              memory: 2512
              ansible_host: 192.168.122.200
              data_disks:
                disk-1:
                  size: 5
...

Or even simpler if no external disks are declared

all:
  vars:
     disk_source: "/mnt/template.qcow2"
     os_family: RedHat
  hosts:
    terraform_node:
      ansible_host: localhost
      ansible_connection: local
    hypervisor_1:
      ansible_host: 10.90.20.12
      ansible_user: root
  children:
    deploy:
      children:
        my_nodes:
          hosts:
            node-0:
              cpu: 2
              memory: 2512
              ansible_host: 192.168.122.200
            node-1:
              cpu: 2
              memory: 2512
              ansible_host: 192.168.122.201

....
@89luca89 89luca89 added enhancement New feature or request experimental This issue needs a deep research and some improvement evaluation labels Jul 5, 2021
@89luca89 89luca89 self-assigned this Jul 5, 2021
@89luca89 89luca89 added this to the 1.3.0 milestone Jul 5, 2021
@89luca89 89luca89 added help wanted Extra attention is needed refactoring Improve the code readability changing nomenclature and/or some other things labels Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request experimental This issue needs a deep research and some improvement evaluation help wanted Extra attention is needed refactoring Improve the code readability changing nomenclature and/or some other things
Projects
None yet
Development

No branches or pull requests

1 participant