---
# file: roles/mysql-client/tasks/main.yml

- name: "MySQL Client Role"
  set_fact: role_mysql_client_started=true
  tags: 'always'

- block:

  - name: "MySQL Client | Install required packages"
    apt: pkg={{item}} state=present
    with_items:
      - mysql-client
      - mytop

  - name: "MySQL Client | Config for easy access for admins"
    template:
      src=admin_my_cnf
      dest=/home/{{ item }}/.my.cnf
      owner={{ item }}
      group=root
      mode='644'
    with_items: '{{ admins }}'

  - name: "MySQL Client | Config for easy access for root"
    template:
      src=admin_my_cnf
      dest=/root/.my.cnf
      owner=root
      group=root
      mode='644'

  when: '"mysql-client" not in excluded_roles'