---
- name: define distribution value for mariadb upstream repository
  set_fact:
    mysql_upstream_dist: "{% if ansible_distribution == 'Fedora' %}fedora24{% else %}rhel{{ ansible_distribution_version }}{% endif %}"

- name: ensure yum repository for mariadb upstream is configured
  yum_repository:
    name: mariadb
    description: MariaDB
    baseurl: "http://yum.mariadb.org/{{ mysql_upstream_version }}/{{ mysql_upstream_dist }}-amd64"
    gpgkey: https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck: yes

---
- name: define distribution value for mariadb upstream repository
  set_fact:
    mysql_upstream_dist: "{% if ansible_distribution == 'Fedora' %}fedora{{ ansible_distribution_major_version }}{% elif ansible_distribution == 'CentOS' %}centos{{ ansible_distribution_major_version }}{% else %}rhel{{ ansible_distribution_version }}{% endif %}"

- name: ensure yum repository for mariadb upstream is configured
  yum_repository:
    name: mariadb
    description: MariaDB
    baseurl: "http://yum.mariadb.org/{{ mysql_upstream_version }}/{{ mysql_upstream_dist }}-amd64"
    gpgkey: https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck: yes

Use fact ansible_distribution_major_version for Fedora and CentOS
Use fact ansible_distribution_major_version for Fedora and CentOS
