1
resposta

"Error establishing a database connection" ao acessar via browse o IP 172.17.177.40. Todas tasks do provisioning.yml executaram com sucesso.

---
- hosts: all
  handlers:
    - name: restart apache
      service:
        name: apache2
        state: restarted
      become: yes

  tasks:
    - name: 'Instala pacotes de dependencia do sistema operacional'
      apt:
        name: "{{ item }}"
        state: latest
      become: yes
      with_items:
        - php5
        - apache2
        - libapache2-mod-php5
        - php5-gd
        - libssh2-php
        - php5-mcrypt
        - mysql-server-5.6
        - python-mysqldb
        - php5-mysql

    - name: 'Cria banco do MySql'
      mysql_db:
       name: wordpress_db
       login_user: root
       state: present

    - name: 'Cria usuario no MySQL'
      mysql_user:
        login_user: root
        name: wordpress_user
        password: 12345
        priv: 'wordpress_db.*:ALL'
        state: present

    - name: 'Baixa do arquivo de instalacao do wordpress'
      get_url:
        url: 'https://wordpress.org/wordpress-5.0.tar.gz'
        dest: '/tmp/wordpress.tar.gz'
      become: yes

    - name: 'Descompactar arquivo wordpress'
      unarchive:
        src: '/tmp/wordpress.tar.gz'
        dest: /var/www
        remote_src: yes
      become: yes

    - name: 'Copia wp-config-sample.php para wp-config.php'
      copy:
        src: '/var/www/wordpress/wp-config-sample.php'
        dest: '/var/www/wordpress/wp-config.php'
        remote_src: yes
      become: yes

    - name: 'Configura o wp-config.php com as entradas do banco de dados'
      replace:
        path: '/var/www/wordpress/wp-config.php'
        regexp: "{{ item.regex }}"
        replace: "{{ item.value }}"
      with_items:
        - {regex: 'database_name_here', value: 'wordpress_db'}
        - {regex: 'username_here', value: 'wordpress_use'}
        - {regex: 'password_here', value: '12345'}
      become: yes

    - name: 'Configura o apache para servir o worpress'
      copy:
        src: 'files/000-default.conf'
        dest: '/etc/apache2/sites-available/000-default.conf'
      become: yes
      notify:
        - restart apache
1 resposta

Oi, Edson, tudo bem?

Você poderia compartilhar os demais arquivos para poder testar aqui e averiguar melhor o que está acontecendo?