### dev-lxc.yml Config Files dev-lxc uses a YAML configuration file named `dev-lxc.yml` to define a cluster. The `init` command generates sample config files for various server types. Let's generate a config for a cluster with a standalone Chef Server, Chef Automate server, private Supermarket server, build node and an infrastructure node. ``` dev-lxc init --chef --automate --supermarket --build-nodes --nodes > dev-lxc.yml ``` The contents of `dev-lxc.yml` should look like this. ``` # base_container must be the name of an existing container base_container: b-ubuntu-1404 # list any host directories you want mounted into the servers #mounts: # - /root/work root/work # list any SSH public keys you want added to /home/dev-lxc/.ssh/authorized_keys #ssh-keys: # - /root/work/clusters/id_rsa.pub # DHCP reserved (static) IPs must be selected from the IP range 10.0.3.150 - 254 chef-server: users: # a user's password will be the same as its username - mary-admin - joe-user orgs: demo: admins: - mary-admin non-admins: - joe-user servers: chef.lxc: ipaddress: 10.0.3.203 products: chef-server: manage: push-jobs-server: reporting: supermarket: servers: supermarket.lxc: ipaddress: 10.0.3.206 products: supermarket: automate: servers: automate.lxc: ipaddress: 10.0.3.200 products: delivery: license_path: /CHANGE/ME chef_org: delivery enterprise_name: demo-ent build-nodes: servers: build-node-1.lxc: products: chefdk: # downloaded only nodes: chef_server_url: https://chef.lxc/organizations/demo validation_client_name: demo-validator # comment out or remove the validation_key path to use chef-server keys generated by dev-lxc validation_key: # /path/to/org/validation/key servers: node-1.lxc: products: chef: ``` The dev-lxc.yml config file is very customizable. You can add or remove mounts, products or servers, change ip addresses, server names, the base_container and more. As you can see there are four server types represented by five servers. 1. chef-server - chef.lxc 2. analytics - analytics.lxc 3. supermarket - supermarket.lxc 4. nodes - node-1.lxc #### Global Settings The global settings used by each of the server types are the `base_container`, a list of `mounts` and a list of `ssh-keys`. These settings are described in the config comments. Be sure to set `base_container` in the `dev-lxc.yml` to an existing container's name. This container will be cloned to create each container in the cluster. If you don't already have a container to use as a `base_container` then you can follow the instructions in the [Create a dev-lxc Base Container section](https://github.com/jeremiahsnapp/dev-lxc#create-a-dev-lxc-base-container) to create one. #### Server Specific Settings It is possible to define different values for `base_container`, `mounts` or `ssh-keys` for a particular server type or even for a particular server as you can see in the following snippet. ``` nodes: base_container: b-ubuntu-1404 servers: node-1.lxc: base_container: b-centos-6 node-2.lxc: ``` IP addresses from the range 10.0.3.150 - 254 can be assigned to the servers. If an IP address is not specified then a dynamic IP address is assigned when the server starts. #### mixlib-install Library Automatically Manages a Cache of Product Packages dev-lxc uses the [mixlib-install](https://github.com/chef/mixlib-install) library to download Chef products to a cache in `/var/dev-lxc` in the host VM. This cache is automatically mounted into each server when it starts. A list of Chef products to be installed can be defined for each server using [product names that mixlib-install understands](https://github.com/chef/mixlib-install/blob/master/PRODUCT_MATRIX.md). The channel and version of the product can be defined also. Channel can be `current`, `stable` or `unstable` with `stable` as the default. Version can be `latest` or a version number with `latest` as the default. For example, the following specifies the `current` channel and version `0.16.1` of the `chefdk` product. ``` nodes: servers: node-1.lxc: products: chefdk: channel: current version: 0.16.1 ``` The `package_source` setting can be used to specify a package file on disk. ``` nodes: servers: node-1.lxc: products: chefdk: package_source: /root/chefdk_0.16.1-1_amd64.deb ``` #### Chef Server Orgs/Users When defining a Chef Server you can include organizations and users that will be automatically created and associated accordingly. #### Automatic Integration Between Servers dev-lxc knows how to automatically configure Chef Server standalone, Chef Server tier topology, Chef Server HA 2.0 as well as Chef Automate, Chef Client, Analytics, Compliance and Supermarket. If a Chef Automate, Analytics server or Supermarket server is defined in the same config file as a Chef Server then each server will automatically be integrated with that Chef Server. If a node server with Chef Client or Chef DK installed is defined in the same config file as a Chef Server then the Chef Client will automatically be configured to use that Chef Server. Alternatively, values for `chef_server_url`, `validation_client_name` and `validation_key` can be set in the config file either for all nodes or for each individual node. ``` nodes: chef_server_url: https://chef.lxc/organizations/demo validation_client_name: demo-validator # comment out or remove the validation_key path to use chef-server keys generated by dev-lxc validation_key: # /path/to/org/validation/key servers: node-1.lxc: products: chef: ```