Refactor inventory paths in Ansible actions
This commit is contained in:
@@ -26,7 +26,7 @@ runs:
|
||||
K8S_TARGET: ${{ inputs.k8s-target }}
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
ansible -i ansible/inventory/hosts -u $ANSIBLE_USER -m fetch -a "src=/home/$ANSIBLE_USER/.kube/config dest=~/.kube/config flat=yes" $K8S_TARGET
|
||||
ansible -i inventory/hosts -u $ANSIBLE_USER -m fetch -a "src=/home/$ANSIBLE_USER/.kube/config dest=~/.kube/config flat=yes" $K8S_TARGET
|
||||
|
||||
- name: Forward K8S API Server port
|
||||
shell: bash
|
||||
@@ -37,8 +37,8 @@ runs:
|
||||
K8S_TARGET: ${{ inputs.k8s-target }}
|
||||
run: |
|
||||
# Get Hostname and IP address of the target
|
||||
ANSIBLE_HOST=$(ansible -i ansible/inventory/hosts -u $ANSIBLE_USER -m shell -a "hostname" $K8S_TARGET | grep -oP '(\w+\.){2}\w+' | head -1)
|
||||
IP_ADDR=$(ansible -i ansible/inventory/hosts -u $ANSIBLE_USER -m shell -a "curl -s ifconfig.me" $K8S_TARGET | grep -oP '(\d+\.){3}\d+')
|
||||
ANSIBLE_HOST=$(ansible -i inventory/hosts -u $ANSIBLE_USER -m shell -a "hostname" $K8S_TARGET | grep -oP '(\w+\.){2}\w+' | 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
|
||||
ssh -f -N -L 16443:localhost:16443 $ANSIBLE_USER@$ANSIBLE_HOST
|
||||
|
||||
Reference in New Issue
Block a user