Referencing fact mid-text in when statement

I have seen other people attempting similar things, but what works for them in their scenarios doesn’t seem to work for me. I am sure it must be a syntax issue. I have a similar when statement, but don’t know how to correctly reference my fact within the string as seen below (tried these two, and various other iterations):

`

  • name: Install Spacewalk Repos
    yum:
    name: “{{ item }}”
    state: present
    with_items:
  • first-package-[‘ansible_distribution_major_version’].noarch.rpm
  • second-package[ansible_distribution_major_version].noarch.rpm
    `

Figured it out:

`

`

  • name: Install Spacewalk Repos
    yum:
    name: “{{ item }}”
    state: present
    with_items:
  • “first-package-{{ ansible_distribution_major_version }}.noarch.rpm”
  • “second-package{{ ansible_distribution_major_version }}.noarch.rpm”
    `

`