Refactor Ansible actions to improve host inventory handling

This commit is contained in:
2024-10-06 14:44:22 +02:00
parent f235dea2af
commit c8e82cbab5
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ runs:
K8S_TARGET: ${{ inputs.k8s-target }}
run: |
# Get Hostname and IP address of the target
ANSIBLE_HOST=$(ansible -i inventory/hosts -u $ANSIBLE_USER -m shell -a "hostname" $K8S_TARGET | grep -oP '(\w+\.){2}\w+' | head -1)
ANSIBLE_HOST=$(ansible -i inventory/hosts -u $ANSIBLE_USER -m shell -a "hostname" $K8S_TARGET | grep -oP '([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}' | head -1)
IP_ADDR=$(ansible -i inventory/hosts -u $ANSIBLE_USER -m shell -a "curl -s ifconfig.me" $K8S_TARGET | grep -oP '(\d+\.){3}\d+')
# Forward the k8s API server port to localhost