Confusion about storing and accessing variables

Hello, I’m trying to store a cisco device config in the fact cache, I’m doing it like this:

  • name: “Get Config”
    register: config
    ios_command:
    commands: show running-config

  • name: “Store config as fact”
    set_fact:
    config: “{{ config.stdout }}”
    cacheable: true

While it’s working, the resulting fact being created is the entire output from ios_command, meaning it includes changed, failed, stdout, and stdout_lines.

I thought I was created a variable with “register: config” and then was storing just the stdout part of the variable by doing: config: “{{ config.stdout }}”

Is that not the proper way of accessing a variable?