Files
infra-automation/.ssh-agent-init
ansible 4e28d1633a Update git authentication and documentation
- Created ed25519 SSH key for git operations (secrets/ssh/ansible)
- Configured git to use SSH key authentication with IdentitiesOnly
- Recreated Gitea repository with proper SSH access (ID: 29)
- Added SSH agent auto-initialization script (.ssh-agent-init)
- Created comprehensive git SSH setup documentation
- Updated TODO.md to reflect resolved git push issues
- All git operations now use SSH key authentication

SSH Key Details:
- Passphrase: Documented in secrets/ssh/README.md
- Fingerprint: SHA256:mkgq5V567C/CJas9nbP16kNzzVqs7z7k2X90qdP0QXE
- Auto-load: source /opt/ansible/.ssh-agent-init

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 14:13:34 +01:00

47 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# SSH Agent initialization for ansible automation
SSH_ENV="$HOME/.ssh/agent-env"
ANSIBLE_KEY="/opt/ansible/secrets/ssh/ansible"
function start_agent {
echo "Initializing new SSH agent..."
ssh-agent -s | sed 's/^echo/#echo/' > "${SSH_ENV}"
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
# Add ansible key
if [ -f "$ANSIBLE_KEY" ]; then
cat > /tmp/ansible-askpass.sh << 'ASKPASS'
#!/bin/bash
echo "PenguinsJuggleFlamingPineapples42"
ASKPASS
chmod +x /tmp/ansible-askpass.sh
SSH_ASKPASS=/tmp/ansible-askpass.sh DISPLAY=:0 setsid -w ssh-add "$ANSIBLE_KEY" < /dev/null 2>/dev/null
rm -f /tmp/ansible-askpass.sh
fi
}
# Source SSH agent settings if exists
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent
}
else
start_agent
fi
# Ensure ansible key is loaded
if ! ssh-add -l 2>/dev/null | grep -q "ansible@mymx.me"; then
if [ -f "$ANSIBLE_KEY" ]; then
cat > /tmp/ansible-askpass.sh << 'ASKPASS'
#!/bin/bash
echo "PenguinsJuggleFlamingPineapples42"
ASKPASS
chmod +x /tmp/ansible-askpass.sh
SSH_ASKPASS=/tmp/ansible-askpass.sh DISPLAY=:0 setsid -w ssh-add "$ANSIBLE_KEY" < /dev/null 2>/dev/null
rm -f /tmp/ansible-askpass.sh
fi
fi