diff --git a/README.md b/README.md index 64cfc03..6ecebec 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,8 @@ Example Playbook - django_domain: "im.example.com" - django_http_listen: "{{inventory_hostname}}" - django_admin_password: "test" - - django_app_releaseurl: "https://gitea.caret.be/jens/im/archive/main.tar.gz" + - django_app_gitrepo: "https://gitea.caret.be/jens/im.git" + - django_app_gitversion: "main" ``` ```yaml @@ -60,7 +61,8 @@ Example Playbook - django_http_port: 8000 # needs to be a tar.gz for now # needs to have a settings_template.py.j2 file in the django_appname folder - - django_app_releaseurl: "https://gitea.caret.be/jens/im/archive/main.tar.gz" + - django_app_gitrepo: "https://gitea.caret.be/jens/im.git" + - django_app_gitversion: "v2.0" - django_admin_password: !vault | $ANSIBLE_VAULT;1.1;AES256 33366337663233346138373232353438613362636634393334613935303466343238646361613037 diff --git a/tasks/main.yml b/tasks/main.yml index 81bf50d..0a6b559 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,6 +6,7 @@ - 'python3-django' - 'curl' - 'tar' + - 'git' - 'python3-psycopg2' - 'python3-gunicorn' - 'python3-whitenoise' @@ -23,14 +24,15 @@ home: "{{ django_home }}" shell: "/bin/false" -- name: 'download latest stable version of the app' - get_url: - dest: "{{ django_home }}/latest.tar.gz" - url: "{{ django_app_releaseurl }}" + +- name: Clone git repositories + git: + repo: "{{ django_app_gitrepo }}" + dest: "{{ django_home }}/{{ django_appname }}" owner: "{{ django_user }}" group: "{{ django_group }}" mode: '0400' - force: true + version: "{{ django_app_gitversion }}" - name: 'remove previous install stable' file: