Hi all and thanks in advance for your insights.
OSX Mavericks. Ansible 1.9.4
I've been refactoring an ansible script to work in an EC2 instance and am a
bit stuck at trying to install pip for sudo user, so as to be able to
install psycopg2 for postgres-python integration.
The portion of the Task that's causing the error is this:
- name: check to see if pip is already installed
command: "{{ pip }} --version"
ignore_errors: true
changed_when: false
register: pip_is_installed
changed_when: false
- name: download pip
get_url: url=https://bootstrap.pypa.io/get-pip.py dest={{
pip_download_dest }}
when: pip_is_installed.rc != 0
- name: install pip
command: "{{ python }} {{ pip_download_dest }}/get-pip.py"
sudo: yes
when: pip_is_installed.rc != 0
- name: delete get-pip.py
file: state=absent path={{ pip_download_dest }}/get-pip.py
when: pip_is_installed.rc != 0
# $ pip --version
# pip 1.5.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)
- name: check to see if pip is installed at the correct version
shell: "{{ pip }} --version | awk '{print $2}'"
register: pip_installed_version
changed_when: false
when: pip_version != None or pip_version != "LATEST"
- name: install required version of pip
command: "{{ pip }} install pip=={{ pip_version }}"
sudo: yes
when: pip_version != None and pip_installed_version.stdout != pip_version
and pip_version != "LATEST"
- name: Upgrade to latest version of pip
command: "{{ pip }} install -U pip"
register: pip_latest_output
sudo: yes
changed_when: *pip_latest_output.stdout.find('Requirement already
up-to-date') == -1*
when: pip_version == None or pip_version == "LATEST"
- name: install psycopg2 python module
sudo: yes
pip: name=psycopg2
And the line in bold above seems to be causing an error:
`error while evaluating conditional:
pip_latest_output.stdout.find('Requirement already up-to-date') == -1`
>From what I'm reading on a couple of GitHub issue threads, this error
message can sometimes be misleading.
One thing I'm a little bit unclear on is, Ansible is running on the local
deploying computer and not on the deployed to computer, right? I don't
believe ansible is installed on the remote EC2 OS.
The code looks fairly simple: if the output of running `sudo pip install -U
pip` contains the string, 'Requirement already up-to-date', register as
changed. Right?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c25fb56b-677c-40c8-9197-9831fa7d0fd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.