Skip to content

Commit

Permalink
change SSH port in the AMI instance
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosALgit committed Oct 11, 2024
1 parent e8d5421 commit 2fe99bd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/packages_builder_ami.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,6 @@ jobs:
echo "[gha_instance]" > ${{ env.ALLOCATOR_PATH }}/inventory_ansible.ini
echo "${{ env.ansible_host }} ansible_port=${{ env.ansible_port }} ansible_user=${{ env.ansible_user }} ansible_ssh_private_key_file=${{ env.ansible_ssh_private_key_file }} ansible_ssh_common_args='${{ env.ansible_ssh_common_args }}'" >> ${{ env.ALLOCATOR_PATH }}/inventory_ansible.ini
- name: Change SSH port
run: |
ssh -i "${{ env.ansible_ssh_private_key_file }}" -o StrictHostKeyChecking=no -p ${{ env.ansible_port }} ${{ env.ansible_user }}@${{ env.ansible_host }} << 'EOF'
sudo sed -i 's/^Port 2200/Port 22/' /etc/ssh/sshd_config
sudo systemctl restart sshd
EOF
- name: Run Ansible playbook to install Wazuh components
run: |
ansible-playbook -i ${{ env.ALLOCATOR_PATH }}/inventory_ansible.ini ${{ env.PLAYBOOKS_PATH }}/build_ami_packages.yaml --extra-vars "installation_assistant_reference=${{ inputs.WAZUH_INSTALLATION_ASSISTANT_REFERENCE }}" ${{ inputs.VERBOSITY }}
Expand All @@ -134,6 +127,13 @@ jobs:
run: |
aws ec2 stop-instances --instance-ids ${{ env.identifier }}
- name: Change SSH port
run: |
ssh -i "${{ env.ansible_ssh_private_key_file }}" -o StrictHostKeyChecking=no -p ${{ env.ansible_port }} ${{ env.ansible_user }}@${{ env.ansible_host }} << 'EOF'
sudo sed -i 's/^Port 2200/Port 22/' /etc/ssh/sshd_config
sudo systemctl restart sshd
EOF
- name: Check EC2 instance status until stopped
id: check_status
run: |
Expand Down

0 comments on commit 2fe99bd

Please sign in to comment.