Run task if other has not been run

Hi!
I got a problem that I can’t seem to find a solution to on Google.
I am by the way very new to using Ansible.

My task looks like below:

  • name: Copy file if server in GROUP1. Register output to config_copied
    win_copy:
    src: xxx
    dest: yyy
    remote_src: True
    when: “‘GROUP1’ in group_names”
    register: config_copied

  • name: Copy file if server in GROUP2. Register output to config_copied
    win_copy:
    src: zzz
    dest: yyy
    remote_src: True
    when: “‘GROUP2’ in group_names”
    register: config_copied

##Default config

  • name: Copy default file if no group specific file has been copied. Register output to default_config_copied
    win_copy:
    src: ccc
    dest: yyy
    remote_src: True
    when: config_copied is skipped
    register: default_config_copied

I need to copy a file which is different depending on the group membership.
If no group specific file has been copied (or gotten OK due to up to date) the default config should be copied.

The problem is, if the GROUP1 config gets copied and output is registred to config_copied, then the next step evaluates, the server is NOT a member of GROUP2 and therefore it registers “is skipped” to config_copied.
So even tho the group specific file has been copied config_copied gets overwritten by is skipped.

Does anyone have a solution to my problem? Using different variables for each step wouldn’t work as there will be 40+ groups.

Thanks in advance!