I'm trying to generate a ip list from within a yaml cloud init but keep failing.
Here is what I'd like to do
- path: /etc/hosts
owner: root:root
permissions: '0644'
defer: true
append: true
content: |
%{for i in range(10,19) ~}10.0.10.${i} compute-${i-9}%{endfor ~}
But I get the error:
Call to unknown function; There is no function named "range".
I also tried to pass a list of string and do
%{for str in ${iplst} ~} ${str} %{endfor ~}
But in this case I get
Error: Incorrect attribute value type
│
│ on modules/nfsdbs/nfsdb.tf line 19, in data "template_file" "config":
│ 19: vars = {
│ 20: ...
│ 30: iplst = "${var.ip_list}"
│ 31: ...
│ 33: }
│ ├────────────────
│ │ count.index is a number
│ │ var.aws_access_key_id is a string
│ │ var.aws_region is a string
│ │ var.aws_secret_access_key is a string
│ │ var.aws_session_token is a string
│ │ var.hostname_prefix is a string
│ │ var.ip_list is a list of string
│ │ var.slurmdb_password is a string
│ │ var.ssh_private_key is a string
│ │ var.ssh_public_key is a string
│ │ var.username is a string
│
│ Inappropriate value for attribute "vars": element "iplst": string required.