Working through a Ansible course on Udemy where the instructor or pretty much anyone is helping with Q&A.
I am in a section where I am doing more and more with .yml files. First few steps working good. I am running into 2 problems. One I am not worried about so far but will list below. This first one is keeping me from proceeding.
Environment is 3 Ubuntu VM’s:
control
db02 (a database server)
web03 (a web server, Apache/2.4.7 (Ubuntu), Python 2.7.6)
For the webserver the instructor has provided a simple web application which seems to have been successfully passed to the webserver with tasks copy demo web source and copy apache virtual host config
my webserver yml is as follows:
—
- hosts: webserver
** become: true**
** tasks:**
** - name: install web components**
** apt: name={{item}} state=present update_cache=yes**
** with_items:**
** - apache2**
** - libapache2-mod-wsgi**
** - python-pip**
** - python-virtualenv**
** - name: ensure apache2 started**
** service: name=apache2 state=started enabled=yes**
** - name: ensure mod_wsgi enabled**
** apache2_module: state=present name=wsgi**
** notify: restart apache2**
** - name: copy demo app source**
** copy: src=/home/ansible/demo/app/ dest=/var/www/demo mode=0755**
** notify: restart apache2**
** - name: copy apache virtual host config**
** copy: src=/home/ansible/demo/demo.conf dest=/etc/apache2/sites-available mode=0755**
** notify: restart apache2**
** - name: setup python virtualenv**
** pip: requirements=/var/www/demo/requirements.txt virtualenv=/var/www/demo/.venv**
** notify: restart apache2**
** handlers:**
** - name: restart apache2**
** service: name=apache2 state=restarted**
All but the setup python virtualenv task is working correctly. That task is kicking this error:
**TASK [setup python virtualenv] **
fatal: [web03]: FAILED! => {“changed”: false, “cmd”: [“/var/www/demo/.venv/bin/pip2”, “install”, “-r”, “/var/www/demo/requirements.txt”], “msg”: “stdout: Downloading/unpacking Flask==0.10.1 (from -r /var/www/demo/requirements.txt (line 1))\n Cannot fetch index base URL https://pypi.python.org/simple/\n Could not find any downloads that satisfy the requirement Flask==0.10.1 (from -r /var/www/demo/requirements.txt (line 1))\nCleaning up…\nNo distributions at all found for Flask==0.10.1 (from -r /var/www/demo/requirements.txt (line 1))\nStoring debug log for failure in /root/.pip/pip.log\n”}
I looked on the webserver. All the files seem to be there. Not sure what is going on.
Thanks