-
Notifications
You must be signed in to change notification settings - Fork 18
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
Drive terraform from ansible inventory #240
Draft
sjpb
wants to merge
57
commits into
main
Choose a base branch
from
refactor/templatef3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sjpb
force-pushed
the
refactor/templatef3
branch
from
December 1, 2022 10:05
79b9de9
to
487813d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Release Notes
Define infrastructure using Ansible inventory variables instead of Terraform variables:
cluster_*
andnode_*
in anenvironments/<environment>/inventory/cluster.yml
inventory file. See ansible/roles/terraform/README.md for available variables.ansible-playbook ansible/provision.yml
New/changed functionality
node_*
-prefixed var can vary per-node, so can be defined using groupvars (all
or specific groups) and/or hostvars allowing far more flexibility in node/group definition.instance_id
variable to hosts to support operations on specific instances even with multiple identical hostnames.Configuration
If creating a new environment with cookiecutter, a file
environments/<environment>/inventory/cluster.yml
will be created which contains example infrastructure definition. This should be modified as required.Defaults are defined in
environments/common/inventory/cluster.yml
. Note that this is lower-precedence thanall
groupvars.If necessary, the default terraform templates can be also replaced or extended with environment-specific ones. See TODO:
TODO: Add skeleton cluster config file.
Upgrading
Note that this functionality is opt-in; any current terraform in e.g.
environments/<environment>/terraform/
will not be replaced unless theansible/provision.yml
playbook is run. To "upgrade" a cluster using the previous Terraform:environments/<environment>/inventory/cluster.yml
ansible/provision.yml
playbook and cancel the apply if Terraform says there will be changes.Design Notes
a. groupvars and hostvars can be used when templating ansible, as opposed to the CaaS approach where only
all
groupvars are available from the default localhost.b. With some tweaks to
stackhpc.openhpc
role environment-specific image builds will be possible without having deployed a cluster (as e.g. the slurm control hostname is already known)c. Ansible hostpatterns can be used to define nodenames, e,g.
compute-[0:10]
.inventory_hostnames
are now a short name (e.g.control
which does not contain the cluster name. Actual hostnames are a fqdn including the cluster name. This change is rolled through toansible/roles/etc_hosts
andansible/adhoc/rebuild.yml
. This maintains the current (pervasive!) assumption that inventory_hostnames are resolvable names.community.general.terraform role
is wrapped to (by default) require user confirmation before making changes to infra.TODO:
environments/skeleton/{{cookiecutter.environment}}/
- leaving it in currently to make merges easier.