1
resposta

Erro ao tentar extrair /tmp/wordpress.tar.gz

Ocorre o seguinte erro ao rodar o playbook:

TASK: [Descompactar wordpress] ************************************************
fatal: [172.17.177.40] => file or module does not exist: /tmp/wordpress.tar.gz

FATAL: all hosts have already failed -- aborting

provisioning.yml :

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

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

    - name: 'Cria o usuário do Mysql'
      mysql_user:
        login_user: root
        name: wordpress_user
        password: 123456
        priv: 'wordpress_db.*:ALL'
        state: present

    - name: 'Baixa o arquivo de instalacao do Wordpress'
      get_url:
        url: https://wordpress.org/latest.tar.gz
        dest: /tmp/wordpress.tar.gz
        validate_certs: no

    - name: 'Descompactar wordpress'
      unarchive:
        src: /tmp/wordpress.tar.gz
        dest: /var/www/
        remote_src: yes
      sudo: yes
1 resposta

Olá Cesar,

Acho q eu o erro está na última linha. Para executar o comando como root, precisa do parâmetro "become:" ao invés de "sudo:"