working on it

This commit is contained in:
n0mad1k
2025-04-11 09:56:44 -04:00
parent 4e08f52d77
commit a7490bd655
9 changed files with 983 additions and 233 deletions
+28 -6
View File
@@ -42,13 +42,35 @@
c2_ip: "{{ c2_instance.instance.ipv4[0] }}"
c2_instance_id: "{{ c2_instance.instance.id }}"
# Enhanced SSH wait task for Linode/c2.yml
- name: Wait for C2 SSH to be available
wait_for:
host: "{{ c2_ip }}"
port: 22
delay: 30
timeout: 300
state: started
block:
- name: Initial wait for port to be open
wait_for:
host: "{{ c2_instance.instance.ipv4[0] }}"
port: 22
delay: 60
timeout: 180
state: started
- name: Additional pause for SSH initialization
pause:
seconds: 60
- name: Test SSH connection
command: >
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10
-i {{ ssh_key_path | replace('.pub', '') }} root@{{ c2_instance.instance.ipv4[0] }} echo "SSH Ready"
register: ssh_test
retries: 5
delay: 20
until: ssh_test.rc == 0
ignore_errors: yes
- name: Fail if SSH test unsuccessful
fail:
msg: "Could not connect to C2 server via SSH after multiple attempts"
when: ssh_test.rc != 0
- name: Add C2 to inventory
add_host: