support for variables inside parallelCluster yaml configuration

0

I have seen example configurations where certain items, such as HeadNode.Ssh.KeyName or HeadNode.CustomActions.OnNodeConfigured.Script, need to be modified for specific use cases or cluster instances. These items are currently distributed throughout the yaml files. Is it possible to define variables for such items at the top of the yaml file, then refer to variable names throughout the yaml document. I am thinking of a syntax similar to ansible variables or, in terms of a (hypothetical) parallelCluster configuration

Vars:
  ssh_key_name: key123
  postinstall_path: s3://example123/postinstall.sh
[..]
HeadNode:
  Ssh:
    KeyName: "{{ ssh_key_name }}" 
  CustomActions:
    OnNodeConfigured:
      Script: "{{ postinstall_path }}"

Support for variables would allow one to focus on the top of the yaml configuration during adjustments for specific use cases instead of having to comb through the entire configuration.

asked a year ago236 views
1 Answer
3

Please use YAML nodes anchors for reference https://yaml.org/spec/1.2.2/#692-node-anchors

answered a year ago
  • Thanks for this excellent pointer. Does parallelcluster tolerate "non-canonical" keys such that one could place a sequence of anchor definitions under a key like MyVars: at the beginning of the yaml file?

  • I've run a quick test and it looks like node anchors work with the ParallelCluster CLI, but you can't define a new section in the YAML file with your MyVars structure. Just define the anchor at the first occurrence of your variable and then refer to it later in the rest of the config file.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions