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.

已提问 1 年前243 查看次数
1 回答
3

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

已回答 1 年前
  • 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.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则