From 57cf5c155b9a682d99e34c37e23da601387185b8 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Mon, 4 Nov 2024 18:37:59 +0100 Subject: [PATCH] Add steps for easier provisioning and deployment --- ansible/_add_system_dependencies.yml | 10 ++--- ansible/_create_deployment_directories.yml | 2 +- ansible/provision_app.yml | 45 ++++++++++++++++++++++ 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/ansible/_add_system_dependencies.yml b/ansible/_add_system_dependencies.yml index 3fee1697..a04f89d3 100644 --- a/ansible/_add_system_dependencies.yml +++ b/ansible/_add_system_dependencies.yml @@ -41,11 +41,11 @@ when: install_node is true tags: [fnm-install] -- name: - ansible.builtin.debug: - var: fnm_installed - when: install_node is true - tags: [fnm-install] +# - name: +# ansible.builtin.debug: +# var: fnm_installed +# when: install_node is true +# tags: [fnm-install] - name: Download FNM install (Fast Node Manager) script ansible.builtin.get_url: diff --git a/ansible/_create_deployment_directories.yml b/ansible/_create_deployment_directories.yml index b31ca94d..e0b4c8c3 100644 --- a/ansible/_create_deployment_directories.yml +++ b/ansible/_create_deployment_directories.yml @@ -29,7 +29,7 @@ group: deploy become: true -- name: Move .aws.credentials file to the deploy directory for using with aws cli +- name: Move .aws.credentials file to shared directory ansible.builtin.template: src: "templates/dotaws.credentials.j2" dest: "{{ project_root }}/shared/.aws.credentials" diff --git a/ansible/provision_app.yml b/ansible/provision_app.yml index 4d1fce27..b3a7adde 100644 --- a/ansible/provision_app.yml +++ b/ansible/provision_app.yml @@ -25,11 +25,56 @@ # is a workaround update_front_end_deps: true + project_git_repo: "git@github.com:thegreenwebfoundation/admin-portal.git" + project_deploy_strategy: git + project_version: "{{ project_deploy_branch }}" + project_local_path: "../" + project_unwanted_items: + - .git + project_finalize: true + + # set these to decide about setting up a folder structure as if we are deploying + deploy_project: true + update_symlinks: true + tasks: - name: Set up most recent timestamps directories ansible.builtin.include_tasks: "_create_deployment_directories.yml" when: create_deployment_dirs is true + - name: Run the deploy steps to check out the project repo + ansible.builtin.include_role: + name: f500.project_deploy + when: deploy_project is defined and deploy_project is true + + - name: Link .env to shared directory + ansible.builtin.file: + src: "{{ project_root }}/shared/.env" + dest: "{{ project_root }}/current/.env" + state: link + when: update_symlinks is true + + - name: Link ./media to shared ./media directory + ansible.builtin.file: + src: "{{ project_root }}/shared/media" + dest: "{{ project_root }}/current/media" + state: link + when: update_symlinks is true + + - name: Link ./data to shared ./data directory + ansible.builtin.file: + src: "{{ project_root }}/shared/data" + dest: "{{ project_root }}/current/data" + state: link + when: update_symlinks is true + + - name: Link to .aws.credentials in shared directory + ansible.builtin.file: + src: "{{ project_root }}/shared/.aws.credentials" + dest: "{{ project_root }}/current/.aws.credentials" + state: link + when: update_symlinks is true + - name: Install all system dependencies ansible.builtin.include_tasks: "_add_system_dependencies.yml" when: install_system_reqs is true