I am facing a problem in formatting the last yaml string result

the final yaml is as follows :


hosts: 
  - host: 81MR7M2 
    context: 
      max_images_to_cache: 10

host: “”
cluster: “dev”
env: “test”
cname: “”
hostname: “”
skip_setup_network: false
network_type: “lacp”
bgp_as: 0
force_release: false
setup_cloud_user: true

  • host: 81MN7M2
    context:
    max_images_to_cache: 10
    host: “”
    cluster: “dev”
    env: “test”
    cname: “”
    hostname: “”
    skip_setup_network: false
    network_type: “lacp”
    bgp_as: 0
    force_release: false
    setup_cloud_user: true
    defaults:
    blossom_id: “”
    platform: “hi”
    root_size: 10
    log_size: 15
    audit_size: 3
    var_size: 5
    opt_size: 5
    cache_size: 10
    max_images_to_cache: 6
    vm_owner_ad_group: “APP-PORD-Admin-VM”

but i want to transform it into following format :slight_smile:


hosts:
  - host: 81MR7M2 #host
    context:
      cluster: dev
      env: test
      cname: ""
      hostname: chimera-bios-upgrade-test-01.target.com
      max_images_to_cache: 10
      skip_setup_network: false
      # network_type: lacp
      setup_cloud_user: true
      # any defaults mentioned in defaults can be provided here and will override
  - host: 81MN7M2 #host
    context:
      cluster: dev
      env: test
      cname: ""
      hostname: chimera-bios-upgrades-02.target.com
      max_images_to_cache: 10
      skip_setup_network: false
      # network_type: lacp
      setup_cloud_user: true
      # all values not provided are taken from screen, above are required
defaults: 
  blossom_id:
  platform: hie
  root_size: 10
  log_size: 15
  audit_size: 3
  var_size: 5
  opt_size: 5
  cache_size: 10
  max_images_to_cache: 6
  vm_owner_ad_group: APP-PORD-Admin-VM

can anyone please help me!!

I should do what, and where?