Set root password during autoinstall

Is it possible to set up the root password using Ubuntu autoinstall (i.e. user-data)?

I tried:

user-data:
    disable_root: false
    chpasswd:
      list: |
        root:$6$AYtLXyyVZAea2aLJ$UQxW1cz2vWWNn.17.3QYH5TxZqIMGoLJCpqbBTfClhUKxqouYn7/Yc5Jsq.bCeK0VDLPxbL6xzfJ0xqTb6MLk.

but to no avail.


This should work:

version: 1
user-data:
    disable_root: false
identity:
    hostname: hostname
    username: root
    password: $6$AYtLXyyVZAea2aLJ$UQxW1cz2vWWNn.17.3QYH5TxZqIMGoLJCpqbBTfClhUKxqouYn7/Yc5Jsq.bCeK0VDLPxbL6xzfJ0xqTb6MLk.