---

- name: Choose packages (Oracle)
  set_fact:
    mysql_packages: "{{ mysql_packages_oracle }}"
  when: mysql_variant == "oracle"
  tags:
  - mysql
  - packages

- name: Choose packages (MariaDB)
  set_fact:
    mysql_packages: "{{ mysql_packages_mariadb }}"
  when: mysql_variant == "mariadb"
  tags:
  - mysql
  - packages

- name: Install MySQL packages
  apt:
    name: "{{ mysql_packages }}"
    update_cache: yes
    state: present
  tags:
  - mysql
  - packages

- name: Install MySQL dev packages
  apt:
    name: libmysqlclient-dev
    update_cache: yes
    state: present
  tags:
  - mysql
  - packages
  when: mysql_install_libclient | bool

- name: MySQL is started
  service:
    name: mysql
    state: started
  tags:
  - mysql
  - services

- name: apg package is installed
  apt:
    name: apg
    state: present
  tags:
  - mysql
  - packages
