From a76d25f23c9924539b08d83ddfda1a4e8e8291ed Mon Sep 17 00:00:00 2001 From: Adar Nimrod Date: Tue, 28 Jun 2016 08:53:51 +0300 Subject: [PATCH] - Detect failure when installing Python. - Use variables for OS version and architecture so there's no need to change or re-run Ansible after an upgrade. --- tasks/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 698fcd5..c037922 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,6 +4,7 @@ - name: Install Python raw: "PKG_PATH={{ openbsd_pkg_mirror }}/OpenBSD/$(uname -r)/packages/$(arch -s)/ /usr/sbin/pkg_add -I py-pip" register: openbsd_pkg_add_python + failed_when: "'error' in openbsd_pkg_add_python.stdout|lower" changed_when: "'py-pip' in openbsd_pkg_add_python.stdout" - name: Symlink python @@ -18,7 +19,7 @@ - name: Configure pkg lineinfile: dest: /etc/pkg.conf - line: 'installpath = {{ openbsd_pkg_mirror }}/OpenBSD/{{ ansible_distribution_release }}/packages/{{ ansible_architecture }}/' + line: 'installpath = {{ openbsd_pkg_mirror }}/OpenBSD/%v/packages/%a/' regexp: '^installpath =' state: present create: yes -- GitLab