Refactor file path in actions-validate.yml and add input parameters for vault master password, ansible user, and trusted hosts
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
name: Setup Ansible Environment
|
||||
description: Prepare the environment for A13labs CI/CD pipelines
|
||||
inputs:
|
||||
vault-master-password:
|
||||
description: "The master password for the vault"
|
||||
required: true
|
||||
ansible-user:
|
||||
description: "The user to use for Ansible"
|
||||
required: true
|
||||
trusted-hosts:
|
||||
description: "The list of trusted hosts"
|
||||
required: true
|
||||
outputs:
|
||||
ssh-auth-sock:
|
||||
description: "The SSH_AUTH_SOCK environment variable"
|
||||
value: ${{ steps.start-ssh-agent.outputs.ssh-auth-sock }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
@@ -14,7 +28,7 @@ runs:
|
||||
- name: Setup SSH Key
|
||||
shell: bash
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
VAULT_MASTER_PASSWORD: ${{ inputs.vault-master-password }}
|
||||
run: |
|
||||
sectool ssh unlock ansible
|
||||
mkdir -p ~/.ssh
|
||||
@@ -25,7 +39,7 @@ runs:
|
||||
- name: Read SSH Trusted Hosts keys
|
||||
shell: bash
|
||||
env:
|
||||
TRUSTED_HOSTS: ${{ secrets.TRUSTED_HOSTS }}
|
||||
TRUSTED_HOSTS: ${{ inputs.trusted-hosts }}
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
for HOST in $TRUSTED_HOSTS; do
|
||||
@@ -43,7 +57,7 @@ runs:
|
||||
- name: Start SSH Agent
|
||||
shell: bash
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
VAULT_MASTER_PASSWORD: ${{ inputs.vault-master-password }}
|
||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||
run: |
|
||||
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
|
||||
@@ -54,8 +68,8 @@ runs:
|
||||
- name: Check SSH Connection to remote hosts
|
||||
shell: bash
|
||||
env:
|
||||
TRUSTED_HOSTS: ${{ secrets.TRUSTED_HOSTS }}
|
||||
ANSIBLE_USER: ${{ secrets.ANSIBLE_USER }}
|
||||
TRUSTED_HOSTS: ${{ inputs.trusted-hosts }}
|
||||
ANSIBLE_USER: ${{ inputs.ansible-user }}
|
||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||
run: |
|
||||
for HOST in $TRUSTED_HOSTS; do
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
name: Setup K8S Environment
|
||||
description: Prepare the environment for A13labs CI/CD pipelines
|
||||
inputs:
|
||||
vault-master-password:
|
||||
description: "The master password for the vault"
|
||||
required: true
|
||||
ansible-user:
|
||||
description: "The user to use for Ansible"
|
||||
required: true
|
||||
k8s-target:
|
||||
description: "The target host to deploy the K8S applications"
|
||||
default: "microk8s"
|
||||
@@ -11,8 +17,8 @@ runs:
|
||||
- name: Copy Kube Config from remote host
|
||||
shell: bash
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
ANSIBLE_USER: ${{ secrets.ANSIBLE_USER }}
|
||||
VAULT_MASTER_PASSWORD: ${{ inputs.vault-master-password }}
|
||||
ANSIBLE_USER: ${{ inputs.ansible-user }}
|
||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
@@ -21,7 +27,7 @@ runs:
|
||||
- name: Terraform Init
|
||||
shell: bash
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
VAULT_MASTER_PASSWORD: ${{ inputs.vault-master-password }}
|
||||
run: |
|
||||
cd terraform/k8sapps
|
||||
sectool exec terraform init
|
||||
@@ -29,8 +35,8 @@ runs:
|
||||
- name: Terraform Apply
|
||||
shell: bash
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
ANSIBLE_USER: ${{ secrets.ANSIBLE_USER }}
|
||||
VAULT_MASTER_PASSWORD: ${{ inputs.vault-master-password }}
|
||||
ANSIBLE_USER: ${{ inputs.ansible-user }}
|
||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||
run: |
|
||||
# Get Hostname and IP address of the target
|
||||
|
||||
Reference in New Issue
Block a user