fix7
This commit is contained in:
parent
196e267dbf
commit
262393a0a0
@ -21,6 +21,20 @@
|
|||||||
repo_env_dir: "{{ base_dir }}/ansible_env_staging"
|
repo_env_dir: "{{ base_dir }}/ansible_env_staging"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Write SSH private key to /tmp/deploy_key
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: "{{ ssh_private_key }}"
|
||||||
|
dest: "/tmp/deploy_key"
|
||||||
|
mode: '0600'
|
||||||
|
|
||||||
|
- name: Create SSH wrapper script
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: "/tmp/ssh_wrapper.sh"
|
||||||
|
mode: '0755'
|
||||||
|
content: |
|
||||||
|
#!/bin/sh
|
||||||
|
exec ssh -o StrictHostKeyChecking=no -i /tmp/deploy_key "$@"
|
||||||
|
|
||||||
- name: Remove existing core repo
|
- name: Remove existing core repo
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ repo_core_dir }}"
|
path: "{{ repo_core_dir }}"
|
||||||
@ -31,13 +45,25 @@
|
|||||||
path: "{{ repo_env_dir }}"
|
path: "{{ repo_env_dir }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Clone core repo via SSH
|
- name: Clone core repo via SSH using wrapper
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ repo_core_url }}"
|
repo: "{{ repo_core_url }}"
|
||||||
dest: "{{ repo_core_dir }}"
|
dest: "{{ repo_core_dir }}"
|
||||||
version: "{{ main_br }}"
|
version: "{{ main_br }}"
|
||||||
accept_hostkey: yes
|
accept_hostkey: yes
|
||||||
force: yes
|
force: yes
|
||||||
|
environment:
|
||||||
|
GIT_SSH: /tmp/ssh_wrapper.sh
|
||||||
|
|
||||||
|
- name: Clone env repo via SSH using wrapper
|
||||||
|
ansible.builtin.git:
|
||||||
|
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
|
- name: Debug directory contents after core repo clone
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
@ -47,14 +73,6 @@
|
|||||||
- debug:
|
- debug:
|
||||||
var: core_dir_after_clone.stdout_lines
|
var: core_dir_after_clone.stdout_lines
|
||||||
|
|
||||||
- name: Clone env repo via SSH
|
|
||||||
ansible.builtin.git:
|
|
||||||
repo: "{{ repo_env_url }}"
|
|
||||||
dest: "{{ repo_env_dir }}"
|
|
||||||
version: "{{ env_br }}"
|
|
||||||
accept_hostkey: yes
|
|
||||||
force: yes
|
|
||||||
|
|
||||||
- name: Debug directory contents after env repo clone
|
- name: Debug directory contents after env repo clone
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: ls -la "{{ repo_env_dir }}"
|
cmd: ls -la "{{ repo_env_dir }}"
|
||||||
@ -143,3 +161,11 @@
|
|||||||
volumes:
|
volumes:
|
||||||
- "{{ repo_env_dir }}:/home/cloud/ansible_env_staging"
|
- "{{ repo_env_dir }}:/home/cloud/ansible_env_staging"
|
||||||
|
|
||||||
|
- name: Clean up temp SSH key and wrapper
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: absent
|
||||||
|
loop:
|
||||||
|
- /tmp/deploy_key
|
||||||
|
- /tmp/ssh_wrapper.sh
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user