Skip to content

Instantly share code, notes, and snippets.

@cloudnull
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloudnull/09a498a464dd16ef2824 to your computer and use it in GitHub Desktop.
Save cloudnull/09a498a464dd16ef2824 to your computer and use it in GitHub Desktop.
dynamic inventory update

The dynamic inventory script should be updated to allow for a cleaner, more easily consumable layout. Presently, there are more than a few entries in the inventory parser that have simply been added to container and host entries which are then consumed by the plays in a less than ideal way.

Problem Description

As the inventory is created it should be saved and rederented with the keys sorted so that if the inventory needs to be modified with a text editor its not a nightmare to pickthrough everything to find what needs the update.

Proposed Change

All of the initial work to update inventory would need to be done in the dynamic_inventory.py file though once changed the various plays / templates will need to be updated with the new layout, specifically when accessing host_vars.

Old Inventory:
New Inventory:
Notable changes:
  • The additional of the physical_host_group for container items
  • The poperties key holds other information about the container type. Presently I see the service_name and the default container_release as being easy first entries which would be added as hostvars for a given container type.
  • The container_networks key would house all of the networks being used in a container.

Playbook Impact

A lot of this work has been accomplished here: https://github.com/cloudnull/os-lxc-hosts

The following roles would need to be updated for networking:
  • /opt/ansible-lxc-rpc/rpc_deployment/roles/neutron_common
  • /opt/ansible-lxc-rpc/rpc_deployment/roles/cinder_common
The following roles would need to be updated for is_metal:
  • /opt/ansible-lxc-rpc/rpc_deployment/roles/swift_container
  • /opt/ansible-lxc-rpc/rpc_deployment/roles/neutron_common
  • /opt/ansible-lxc-rpc/rpc_deployment/roles/cinder_device_add
  • /opt/ansible-lxc-rpc/rpc_deployment/roles/neutron_add_network_interfaces
  • /opt/ansible-lxc-rpc/rpc_deployment/roles/container_common
  • /opt/ansible-lxc-rpc/rpc_deployment/roles/common
  • /opt/ansible-lxc-rpc/rpc_deployment/roles/nova_compute_devices
The following roles may be able to be removed:
  • /opt/ansible-lxc-rpc/rpc_deployment/roles/neutron_add_network_interfaces
  • /opt/ansible-lxc-rpc/rpc_deployment/roles/container_extra_setup
The following script may be able to be updated:
  • /opt/ansible-lxc-rpc/scripts/inventory-manage.py

Alternatives

Keep things as-is

Security Impact

None

Notifications Impact

None

Other End User Impact

The user would be able to better understand what is being created and why and they would be able to logically sort / udpate items in inventory if needed.

Performance Impact

There will be an impact when writting the inventory the first time however I would suspect that its minor and would remain un-noticed to the enduser.

Other Deployer Impact

Faster deployments. With the inventory parsed in this way much more of the container configuration can be done upfront. By being able to do the container network and deployment ealier most of the host and container setup roles can be consolodated making it so that there are far fewer redundant tasks.

Developer Impact

The playbooks would need to be updated to use the new layout. Future playbook development to be cleaner however some of the original playbooks would need to be refactored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment