Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Access denied for user root

Encontrei este problema para rodar o playbook no mysql-server-5.7. Podem ajudar?

PLAY [all] *************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************************************************
ok: [172.28.128.8]

TASK [Install PHP, Apache2 and Mysql dependencies] *********************************************************************************************************************************************************
ok: [172.28.128.8]

TASK [Create mysql database - wordpress_db] ****************************************************************************************************************************************************************
fatal: [172.28.128.8]: FAILED! => {"changed": false, "msg": "unable to find /home/vagrant/.my.cnf. Exception message: (1698, \"Access denied for user 'root'@'localhost'\")"}
    to retry, use: --limit @/home/sylvioneto/Downloads/cursos/devops_vagrant/env_wordpress/config/ansible/wordpress/playbook.retry

PLAY RECAP *************************************************************************************************************************************************************************************************
172.28.128.8               : ok=2    changed=0    unreachable=0    failed=1   

Playbook:

---
- hosts: all
  tasks:
    - name: Install PHP, Apache2 and Mysql dependencies
      apt:
        update_cache: yes
        name: 
          - php7.2
          - apache2
          - libapache2-mod-php7.2
          - php7.2-cli
          - php7.2-common
          - php7.2-mbstring
          - php7.2-gd
          - php7.2-intl
          - php7.2-xml
          - php7.2-mysql
          - php7.2-zip
          - mysql-server-5.7
          - python3-mysqldb
        state: latest
      become: yes

    - name: Create mysql database - wordpress_db
      mysql_db:
        login_user: root
        name: wordpress_db
        state: present 
1 resposta
solução!

Consegui consertar, precisa adicionar o become: yes e remover o login and user.

Acho que vale a pela atualizar o texto da aula.

- name: Create mysql database - wordpress_db
      mysql_db:
        name: wordpress_db
        state: present 
      become: yes