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.

posta un anno fa243 visualizzazioni
1 Risposta
3

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

con risposta un anno fa
  • 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.

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande