title: What does it mean and how to fix Ansible error " 'NoneType' object has no attribute 'read' "?
body: <p>I am trying to install MySql 5.7 version through Ansible, but it is saying </p>
  
  <pre><code>fatal: [192.168.1.45]: FAILED! =&gt; {"changed": false, "failed": true, "msg": "Failure downloading http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm, 'NoneType' object has no attribute 'read'"}
  
  </code></pre>
  
  <p>To fix the issue i tried setting up proxy in the environment section, but still it is failing.
  Below is the script, through which I am trying to install MySQL</p>
  
  <pre><code>---
  - hosts: dbservers
    remote_user: yabx
    become: true
    become_method: sudo
    become_user: root
    tasks:
      - name: Install MySQL 5.7 repo
        yum: name=http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm state=present
  
      - name: Install MySQL 5.7
        yum: pkg={{ item }}
        with_items:
        - mysql-community-server
        - mysql-community-client
        - MySQL-python
  
      - name: Start the MySQL service
        service: name=mysqld state=started enabled=true
  
      - name: Change mysql root password and keep track in
        shell: |
          password_match=`awk '/A temporary password is generated for/ {a=$0} END{ print a }' /var/log/mysqld.log | awk '{print $(NF)}'`
          echo $password_match
          mysql -uroot -p$password_match --connect-expired-password -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'PassW0rd'; flush privileges; "
          echo "[client]"
          user=root
          password=PassW0rd &gt; /root/.my.cnf
        args:
          creates: /root/.my.cnf
        register: change_temp_pass
        notify: restart mysqld
  
      - meta: flush_handlers
      - debug:
          var: change_temp_pass
  
    handlers:
      - name: restart mysqld
        service:
          name: mysqld
          state: restarted
        environment:
          http_proxy: http://***:***@192.168.1.45:8080
          https_proxy: https://***:***@192.168.1.45:8080
  </code></pre>
  
  <p>I want MySQL to be installed on my RHEL 7.4 through Ansible script.</p>