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

RUNNING HANDLER [restart apache]

Controller

RUNNING HANDLER [restart apache] ********************************************************************************************************************************************************************
fatal: [172.17.177.40]: FAILED! => {"changed": false, "msg": "Output of config test was:\napache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 2 of /etc/apache2/sites-enabled/000-default.conf: /etc/apache2/sites-enabled/000-default.conf:2: <VirtualHost> was not closed.\nAction 'configtest' failed.\nThe Apache error log may have more information.\n"}
        to retry, use: --limit @/home/thiago/ansible/wordpress_com_ansible/provisioning.retry

PLAY RECAP ******************************************************************************************************************************************************************************************
172.17.177.40              : ok=9    changed=3    unreachable=0    failed=1

Host

vagrant@vagrant-ubuntu-trusty-64:~$ /etc/init.d/apache2 restart
 * Restarting web server apache2                                                                                                                                                              [fail] 
 * The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 2 of /etc/apache2/sites-enabled/000-default.conf: /etc/apache2/sites-enabled/000-default.conf:2: <VirtualHost> was not closed.
Action 'configtest' failed.
The Apache error log may have more information.
vagrant@vagrant-ubuntu-trusty-64:~$ 

/etc/apache2/apache2.conf


215    # Include generic snippets of statements
216    IncludeOptional conf-enabled/*.conf
217    
218    # Include the virtual host configurations:
219    IncludeOptional sites-enabled/*.conf

provisioning.yml

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

Erro corrigido.

Na Aula 6 - 06 Reiniciando serviços com Handlers, eu havia copiado apenas um pedaço do conteúdo do arquivo /etc/apache2/sites-available/000-default.conf que estava postado, conforme abaixo.

vagrant@vagrant-ubuntu-trusty-64:~$ cat /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request´s Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not devisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicity.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

Depois verifiquei que nessa parte do texto, estava faltando a outra parte do conteúdo com o fechamento da tag </VirtualHost>. Então peguei o conteúdo do próprio arquivo do meu host e alterei e deu certo. Também já sugeri a alteração nessa aula.

File: /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/wordpress

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet