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

Simplify hosts.yaml format #253

Open
RandyLevensalor opened this issue Jun 28, 2019 · 2 comments
Open

Simplify hosts.yaml format #253

RandyLevensalor opened this issue Jun 28, 2019 · 2 comments
Labels
ansible Refactor with ansible

Comments

@RandyLevensalor
Copy link
Collaborator

RandyLevensalor commented Jun 28, 2019

hosts.yaml is currently configured by task and not by compute node.

There are many duplicate entities required.

Have one yaml element for each server and only require a minimum of items are uniqure to each server, just as server name, IPs and MAC address.

Items that can be shared across servers, can be in a globals section. Only list the dns server once. If all servers have the same NIC layout, then that can be mapped in globals etc.

Allow for customizing individual servers. The customization would have a priority over the global values.

Example hosts.yaml

---
snaps-boot:
  globals:
    digitalRebar:
      user: rocketskates
      password: r0cketsk8ts
    subnets:
      - subnet: management
        address: "10.197.121.0/24"
        name: Managment_SUBNET
        netmask: "255.255.255.0"
        range: "10.197.121.22 10.197.121.26"
        router: "10.197.121.1"
        default_interface: eno1
      - subnet: tenant
        address: "10.197.122.0/24"
        name: Tenant_SUBNET
        netmask: "255.255.255.0"
        range: "10.197.122.22 10.197.122.26"
        default_interface: eno2
      - subnet: public
        address: "10.197.123.0/24"
        name: Public_SUBNET
        netmask: "255.255.255.0"
        range: "10.197.123.22 10.197.123.26"
        router: "10.197.123.1"
        default_interface: eno3
    dn: cablelabs.com
    dns: "8.8.8.8"
    PROXY:
      ftp_proxy: ""
      http_proxy: ""
      https_proxy: ""
      #user to provide ngcacher_proxy only in case when servers are behind company
      #firewall, else left blank.
      ngcacher_proxy: ""
    PXE:
      bmc_user: admin
      bmc_password: foobarr
      pxe_server_ip: "10.197.121.21"
      pxe_server_interface: "ens3"

# configuration information for target servers
# these are the servers that we are installing
      target_globals:
# these keys are only global
        user: snaps
        group: snaps
        pxe_network_name: Managment_SUBNET
# keys beginning with defualt_ can be overridden on a per target basis
        default_os: "ubuntu 18.04"
        password: ChangeME123
        timezone: America/Denver
        default_boot_disk: sda
        default_kernel_choice: linux-server

  targets:
     -
      name: master
      pxe_boot_mac: "ec:b1:d7:7f:5a:6c"
      bmc_ip: "10.197.124.22"
     -
      name: minion1
      pxe_boot_mac: "ec:b1:d7:7f:8a:9c"
      bmc_ip: "10.197.124.23"
      isolcpus: "0-20,1-22"
      hugepagesz: "2M"
      hugepages: "2048"
     -
      name: minion2
      pxe_boot_mac: "ec:b1:d7:7f:4a:08"
      bmc_ip: "10.197.124.24"
      isolcpus: "0-20,1-22"
      hugepagesz: "2M"
      hugepages: "2048"
@RandyLevensalor RandyLevensalor added the ansible Refactor with ansible label Jun 28, 2019
@medberry
Copy link
Contributor

You can also use group vars. Just keep it simple for manageability.

@willtome
Copy link
Collaborator

I would propose the following Ansible inventory compatible format. The required groups are build,master, and minion. These will be referenced by the Ansible playbooks. Host specific variables pxe_boot_mac and bmc_ip are required for any system being booted via PXE. Variables can be assigned to either the minion group or the individual hosts to override default values. Any global values will reside in the vars section of the all group. This format will also enable to utilization for Ansible Vault for encryption of passwords or other sensitive data.

---
build:
  hosts:
    localhost

master:
  hosts:
    master1:
      pxe_boot_mac: "ec:b1:d7:7f:5a:6c"
      bmc_ip: "10.197.124.22"
minion:
  hosts:
    minion1:
      pxe_boot_mac: "ec:b1:d7:7f:8a:9c"
      bmc_ip: "10.197.124.623"
    minion2:
      pxe_boot_mac: "ec:b1:d7:7f:4a:08"
      bmc_ip: "10.197.124.24"
      hugepagesz: "4M"
    minion3:
  vars:
    isolcpus: "0-20,1-22"
    hugepagesz: "2M"
    hugepages: "2048"


all:
  vars:
    digitalRebar:
      user: rocketskates
      password: r0cketsk8ts
    subnets:
      - subnet: management
        address: "10.197.121.0/24"
        name: Managment_SUBNET
        netmask: "255.255.255.0"
        range: "10.197.121.22 10.197.121.26"
        router: "10.197.121.1"
        default_interface: eno1
      - subnet: tenant
        address: "10.197.122.0/24"
        name: Tenant_SUBNET
        netmask: "255.255.255.0"
        range: "10.197.122.22 10.197.122.26"
        default_interface: eno2
      - subnet: public
        address: "10.197.123.0/24"
        name: Public_SUBNET
        netmask: "255.255.255.0"
        range: "10.197.123.22 10.197.123.26"
        router: "10.197.123.1"
        default_interface: eno3
    dn: cablelabs.com
    dns: "8.8.8.8"
    PROXY:
      ftp_proxy: ""
      http_proxy: ""
      https_proxy: ""
      #user to provide ngcacher_proxy only in case when servers are behind company
      #firewall, else left blank.
      ngcacher_proxy: ""
    PXE:
      bmc_user: admin
      bmc_password: foobarr
      pxe_server_ip: "10.197.121.21"
      pxe_server_interface: "ens3"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ansible Refactor with ansible
Projects
None yet
Development

No branches or pull requests

3 participants