---

- block:
  - name: Set MySQL server password
    debconf:
      name: mysql-server
      question: mysql-server/root_password{{item}}
      value: "{{ mysql_server_root_password }}"
      vtype: password
    with_items:
      - ""
      - _again

  - name: Install MySQL server
    apt:
      name: mysql-server-{{ mysql_version }}
      state: present
      update_cache: yes
      cache_valid_time: 3600

  - name: start mysql
    service:
      name: mysql
      state: started
  become: yes
