This commit is contained in:
faten 2025-06-02 14:14:27 +00:00
parent 073787297e
commit 6b6e2a0ed2

View File

@ -1,4 +1,3 @@
---
- name: Clone SSH repos, inject private key, build and run container
hosts: docker_host
gather_facts: false
@ -9,11 +8,12 @@
playbook_file: "{{ lookup('env', 'PLAYBOOK_FILE') | default('base.yaml') }}"
ssh_private_key: "{{ lookup('env', 'SSH_PRIVATE_KEY') }}"
base_dir: "/home/ubuntu"
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: "ansible_core_init_ansible"
repo_env_dir: "ansible_env_staging"
repo_core_dir: "{{ base_dir }}/ansible_core_init_ansible"
repo_env_dir: "{{ base_dir }}/ansible_env_staging"
tasks:
- name: Remove existing core repo
@ -32,6 +32,7 @@
dest: "{{ repo_core_dir }}"
version: "{{ main_br }}"
accept_hostkey: yes
force: yes
- name: Clone env repo via SSH
ansible.builtin.git:
@ -39,6 +40,7 @@
dest: "{{ repo_env_dir }}"
version: "{{ env_br }}"
accept_hostkey: yes
force: yes
- name: Inject SSH private key into custom_files/id_rsa
ansible.builtin.copy:
@ -46,9 +48,9 @@
dest: "{{ repo_core_dir }}/custom_files/id_rsa"
mode: '0600'
- name: List contents of core repo directory
- name: List contents of core repo directory for debug
ansible.builtin.command:
cmd: ls -l "{{ repo_core_dir }}"
cmd: ls -la "{{ repo_core_dir }}"
register: repo_core_ls
- name: Debug repo_core_ls
@ -63,7 +65,7 @@
build:
path: "{{ repo_core_dir }}"
args:
branch: main
branch: "{{ main_br }}"
nocache: true
- name: Run the admin container
@ -75,5 +77,5 @@
interactive: true
auto_remove: true
volumes:
- "{{ repo_env_dir | realpath }}:/home/cloud/ansible_env_staging"
- "{{ repo_env_dir }}:/home/cloud/ansible_env_staging"