1
resposta

Ansible com erro The read operation timed out

Ao realizar o exercicio proposto é apresentado esse erro de forma intermitente, as vezes eu executo e funciona e após re-executar apresenta a falha abaixo.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: socket.timeout: The read operation timed out
fatal: [172.17.177.40]: FAILED! => {"changed": false, "elapsed": 0, "msg": "failed to create temporary content file: The read operation timed out"}

Meu playbook:

---
- hosts: all
  tasks:
    - name: 'Instala pacotes de dependencia do sistema operacional'
      apt:
        name:
          - php7.2
          - apache2
          - libapache2-mod-php7.2
          - php7.2-gd
          - php-ssh2 
          - mysql-server-5.7
          - php7.2-mysql
          - python-mysqldb
        state: latest
      become: yes

    - name: 'Cria o banco do MySQL'
      mysql_db: 
        name: wordpress_db
        state: present
      become: yes

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

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

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

Fiz algumas pesquisas na internet mas não achei nada que ajude.

Segue meu arquivo VagrantFile:

Vagrant.configure("2") do |config|

  #config.vm.box = "ubuntu/trusty64"
  config.vm.box = "ubuntu/bionic64"
  config.vm.provider "virtualbox" do |v|
    v.memory = 512
    v.name = "wordpress"
  end

  config.vm.define "wordpress" do |wordpress|
    wordpress.vm.network "private_network", ip: "172.17.177.40"

    wordpress.vm.provision "shell", inline: "apt-get -y update && apt-get -y upgrade "

    wordpress.vm.provision "shell", inline: "sudo apt install python3-pip"

    wordpress.vm.provision "shell",
      inline: "cat /vagrant/configs/ssh-keys/vagrant_id_rsa.pub >> .ssh/authorized_keys"
    wordpress.vm.provision "shell",
      inline: "cp /vagrant/configs/ssh-keys/vagrant_id_rsa /home/vagrant/vagrant_id_rsa && \
            chmod 600 /home/vagrant/vagrant_id_rsa && \
                chown vagrant:vagrant /home/vagrant/vagrant_id_rsa"
  end              

  config.vm.define "ansi" do |ansi|

    ansi.vm.network "private_network", ip: "172.17.177.41"
    ansi.vm.box = "ubuntu/bionic64"
    #ansi.vm.box = "ubuntu/xenial64"

        ansi.vm.provider "virtualbox" do |vb|
            vb.memory = 512
            vb.cpus = 1
            vb.name = "bionic_ansi"
    end

    ansi.vm.provision "shell", inline: "apt-get -y update && apt-get -y upgrade "

    ansi.vm.provision "shell", inline: "sudo apt install python3-pip"

    ansi.vm.provision "shell",
      inline: "cat /vagrant/configs/ssh-keys/vagrant_id_rsa.pub >> .ssh/authorized_keys"

    ansi.vm.provision "shell",
      inline: "cp /vagrant/configs/ssh-keys/vagrant_id_rsa /home/vagrant/vagrant_id_rsa && \
            chmod 600 /home/vagrant/vagrant_id_rsa && \
                chown vagrant:vagrant /home/vagrant/vagrant_id_rsa"

    ansi.vm.provision "shell",
      inline: "apt-get update && \
                apt-get install -y software-properties-common && \
                apt-add-repository --yes --update ppa:ansible/ansible && \
                apt-get install -y ansible"

  end

end

Arquivo hosts:

[wordpress]
172.17.177.40

[wordpress:vars]
ansible_user=vagrant
ansible_ssh_private_key_file=/home/vagrant/vagrant_id_rsa
ansible_python_interpreter=/usr/bin/python3
ansible_ssh_common_args='-o StrictHostKeyChecking=no'
1 resposta

Olá Leonardo, tudo bem? Talvez não seja isso, porém já vai evitar um erro relacionado a versão do PHP com o decorrer dos cursos, então sugiro você colocar a seguinte URL para o download do wordpress:

url: 'https://wordpress.org/wordpress-5.0.tar.gz'

Tenta isso e fala pra gente se ajudou!