commit 123

This commit is contained in:
faten 2025-06-02 16:02:44 +00:00
parent 262393a0a0
commit 94c51f716b

View File

@ -21,19 +21,20 @@
repo_env_dir: "{{ base_dir }}/ansible_env_staging"
tasks:
- name: Write SSH private key to /tmp/deploy_key
ansible.builtin.copy:
content: "{{ ssh_private_key }}"
dest: "/tmp/deploy_key"
dest: /tmp/deploy_key
mode: '0600'
- name: Create SSH wrapper script
ansible.builtin.copy:
dest: "/tmp/ssh_wrapper.sh"
dest: /tmp/ssh_wrapper.sh
mode: '0755'
content: |
#!/bin/sh
exec ssh -o StrictHostKeyChecking=no -i /tmp/deploy_key "$@"
exec ssh -i /tmp/deploy_key -o StrictHostKeyChecking=no -o BatchMode=yes "$@"
- name: Remove existing core repo
ansible.builtin.file:
@ -50,7 +51,6 @@
repo: "{{ repo_core_url }}"
dest: "{{ repo_core_dir }}"
version: "{{ main_br }}"
accept_hostkey: yes
force: yes
environment:
GIT_SSH: /tmp/ssh_wrapper.sh
@ -60,80 +60,11 @@
repo: "{{ repo_env_url }}"
dest: "{{ repo_env_dir }}"
version: "{{ env_br }}"
accept_hostkey: yes
force: yes
environment:
GIT_SSH: /tmp/ssh_wrapper.sh
- name: Debug directory contents after core repo clone
ansible.builtin.command:
cmd: ls -la "{{ repo_core_dir }}"
register: core_dir_after_clone
- debug:
var: core_dir_after_clone.stdout_lines
- name: Debug directory contents after env repo clone
ansible.builtin.command:
cmd: ls -la "{{ repo_env_dir }}"
register: env_dir_after_clone
- debug:
var: env_dir_after_clone.stdout_lines
- name: Check if core repo dir exists and permissions
ansible.builtin.stat:
path: "{{ repo_core_dir }}"
register: core_dir_stat
- debug:
var: core_dir_stat
- name: Check if env repo dir exists and permissions
ansible.builtin.stat:
path: "{{ repo_env_dir }}"
register: env_dir_stat
- debug:
var: env_dir_stat
- name: List contents of core repo directory
ansible.builtin.command:
cmd: ls -la "{{ repo_core_dir }}"
register: repo_core_ls
- debug:
var: repo_core_ls.stdout_lines
- name: List contents of env repo directory
ansible.builtin.command:
cmd: ls -la "{{ repo_env_dir }}"
register: repo_env_ls
- debug:
var: repo_env_ls.stdout_lines
- name: List repo core directory tree (recursive)
ansible.builtin.command:
cmd: find "{{ repo_core_dir }}"
register: repo_core_tree
failed_when: false
changed_when: false
- debug:
var: repo_core_tree.stdout_lines
- name: List repo env directory tree (recursive)
ansible.builtin.command:
cmd: find "{{ repo_env_dir }}"
register: repo_env_tree
failed_when: false
changed_when: false
- debug:
var: repo_env_tree.stdout_lines
- name: Inject SSH private key into custom_files/id_rsa
- name: Inject SSH private key into custom_files/id_rsa (for Docker build)
ansible.builtin.copy:
content: "{{ ssh_private_key }}"
dest: "{{ repo_core_dir }}/custom_files/id_rsa"
@ -161,7 +92,7 @@
volumes:
- "{{ repo_env_dir }}:/home/cloud/ansible_env_staging"
- name: Clean up temp SSH key and wrapper
- name: Clean up SSH key and wrapper
ansible.builtin.file:
path: "{{ item }}"
state: absent