vscode syntax highlighting

I recently got around to uninstalling the old MS ansible extension and installing the new one. First thing I noticed is the syntax highlighting seems weaker. I’ve had all sorts of ansible and yaml extensions installed, so I’m not sure if it’s me and my config or features yet to be implemented.

Is there schema config I’m missing?

The old one:

the new one:

I am trying to do the following.
I have a variable yaml

eg:
group_vars.yml
G1:

  • groupname: A
    G2:
  • groupname: B
    G3:
  • groupname: C
    G4:
  • groupname: D

I have this task and I want to pass just the G1 and G2 as extra_vars to the “groups_name” from the command line. How do I go about doing it?

  • include_vars: group_vars.yml
  • name: Create Group(s)

group:

name: “{{ item.groupname }}”

state: present

with_items:

  • “{{groups_name}}”

Cheers

group_vars.yml
G1:
- groupname: A
G2:
  - groupname: B
G3:
- groupname: C
G4:
- groupname: D

... pass just the G1 and G2 as extra_vars to "groups_name" from the command line.
- include_vars: group_vars.yml
- name: Create Group(s)
  group:
    name: "{{ item.groupname }}"
    state: present
  with_items:
     - "{{groups_name}}"

Put the data into dictionaries, e.g.

  > cat group_vars.yml
  G1:
    groupname: A
  G2:
    groupname: B
  G3:
    groupname: C
  G4:
    groupname: D

Include the variables into a dictionary and extract the keys, e.g.

    - include_vars:
        file: group_vars.yml
        name: d1
    - debug:
        msg: "{{ item.groupname }}"
      loop: "{{ groups_name|
                default()|
                map('extract', d1)|
                list }}"

The command

  > ansible-playbook pb.yml -e '{"groups_name": ["G1","G2"]}'

should give

  msg: A
  msg: B

If you have to keep the data in the lists select the the first item

        msg: "{{ item.0.groupname }}"