From c81062d2c2253b357004fd0700bd4a7592616798 Mon Sep 17 00:00:00 2001 From: faten Date: Mon, 2 Jun 2025 16:27:08 +0000 Subject: [PATCH] the admin container --- containerAdmin.yml | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/containerAdmin.yml b/containerAdmin.yml index 687b62f..16c7572 100644 --- a/containerAdmin.yml +++ b/containerAdmin.yml @@ -1,4 +1,4 @@ -- name: Prepare SSH key, clone repos, build image, and run container +- name: Prepare, clone repos, build image, and run container hosts: docker_host remote_user: ubuntu become: yes @@ -8,19 +8,12 @@ main_br: "{{ lookup('env', 'MAIN_BR') | default('main', true) }}" env_br: "{{ lookup('env', 'ENV_BR') | default('main', true) }}" base_dir: "/home/ubuntu" - deploy_key_path: "/tmp/deploy_key" repo_core_url: "git@git.felcloud.io:felcloud/ansible_core_init_ansible.git" repo_env_url: "git@git.felcloud.io:felcloud/ansible_env_staging.git" repo_core_dir: "{{ base_dir }}/ansible_core_init_ansible" repo_env_dir: "{{ base_dir }}/ansible_env_staging" tasks: - - name: Write SSH private key to remote host - ansible.builtin.copy: - content: "{{ lookup('env', 'SSH_PRIVATE_KEY') }}" - dest: "{{ deploy_key_path }}" - mode: '0600' - - name: Remove existing core repo ansible.builtin.file: path: "{{ repo_core_dir }}" @@ -31,30 +24,19 @@ path: "{{ repo_env_dir }}" state: absent - - name: Clone core repo using SSH key + - name: Clone core repo ansible.builtin.git: repo: "{{ repo_core_url }}" dest: "{{ repo_core_dir }}" version: "{{ main_br }}" force: yes - environment: - GIT_SSH_COMMAND: "ssh -i {{ deploy_key_path }} -o StrictHostKeyChecking=no -o BatchMode=yes" - - name: Clone env repo using SSH key + - name: Clone env repo ansible.builtin.git: repo: "{{ repo_env_url }}" dest: "{{ repo_env_dir }}" version: "{{ env_br }}" force: yes - environment: - GIT_SSH_COMMAND: "ssh -i {{ deploy_key_path }} -o StrictHostKeyChecking=no -o BatchMode=yes" - - - name: Copy SSH key into core repo for Docker build - ansible.builtin.copy: - src: "{{ deploy_key_path }}" - dest: "{{ repo_core_dir }}/custom_files/id_rsa" - remote_src: yes - mode: '0600' - name: Build Docker image community.docker.docker_image: