Correct deploy script to use pyenv 0.2.3
authorymh <ymh.work@gmail.com>
Tue, 29 Mar 2022 11:23:38 +0200
changeset 210 3de92ddba2de
parent 209 a01e6a4dc9d2
child 211 244a90638e80
Correct deploy script to use pyenv
deploy/deploy.yml
--- a/deploy/deploy.yml	Thu Jul 29 19:04:01 2021 +0200
+++ b/deploy/deploy.yml	Tue Mar 29 11:23:38 2022 +0200
@@ -61,20 +61,21 @@
 #
 # all actions
 #
-- hosts: remote_backend
+# - hosts: remote_backend
+- hosts: localhost
+  connection: local
   vars:
     backend_build_dir: "{{playbook_dir}}/build/tmp/irinotes/src"
     client_dir: "{{playbook_dir}}/build/tmp/irinotes/client"
   tasks:
 
     - name: get backend version
-      local_action: command python setup.py -V chdir="{{backend_build_dir}}"
+      command: python setup.py -V chdir="{{backend_build_dir}}"
       register: backend_version
 
     - name: get discussion package version
       set_fact:
         backend_pkg_version: "{{backend_version.stdout}}"
-
 #
 # Localhost actions
 #
@@ -161,6 +162,7 @@
   become: yes
   vars:
     backend_build_dir: "{{playbook_dir}}/build/tmp/irinotes/src"
+    backend_pkg_version: "{{hostvars['localhost']['backend_pkg_version']}}"
   tasks:
 
     - name: add iri group
@@ -243,10 +245,12 @@
 
         - name: create backend virtualenv
           pip:
-              virtualenv_command: /usr/bin/python3 -m venv
+              virtualenv_command: /usr/local/share/pyenv/shims/python -m venv
               virtualenv: "{{backend_venv}}"
               name: pip
               state: latest
+          environment:
+              PYENV_VERSION: "3.9.12"
           when: (copy_backend_requirements_base.changed or copy_backend_requirements_prod.changed) or (not backend_venv_stats.stat.exists)
 
         - name: virtualenv install requirements