---
# DEV-375
# "fixes" error for mysql-connect as root-user
# it's just a restore server ...
- name: "Ensure passwordless mysql-connect for root "
  copy:
    dest: '/root/.my.cnf'
    owner: root
    group: root
    mode: '0600'
    content: |
      [client]
      user={{ mysql_root_username }}
      password={{ mysql_root_password }}

- name: "Install mariadb-server via include_role"
  include_role:
    name: maria

- name: "Copy restore script to restore server"
  copy:
    src: restore.sh
    dest: '/root/restore.sh'
    mode: '0750'
    owner: root
    group: root

- name: "Create file for gpg secret key"
  become: yes
  copy:
    dest: '/root/gpg_private_key'
    mode: '0600'
    owner: 'root'
    group: 'root'
    content: |
      {{ gpg_key_smardigo_automation__private }}

- name: "Import private gpg key" # noqa command-instead-of-shell
  become: yes
  shell: 'gpg --import /root/gpg_private_key'
  register: gpg_import
  changed_when:
    - gpg_import.rc != '0'
