Skip to content

Commit

Permalink
Test 1
Browse files Browse the repository at this point in the history
  • Loading branch information
YisDav committed Nov 12, 2024
1 parent ed5c197 commit 5714f03
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions .github/workflows/distributed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ on:
env:
COMPOSITE_NAME: "linux-SUBNAME-amd64"
ALLOCATOR_PATH: "/tmp/allocator_instance"
INSTANCE_NAMES: "wi1,wi2,wi3,dashboard,manager,worker"
permissions:
id-token: write # JWT
contents: read # actions/checkout
Expand All @@ -44,7 +45,7 @@ jobs:
if [ "${{ inputs.SYSTEMS }}" != "null" && "${{ inputs.SYSTEMS }}" != "" ]; then
SYSTEMS_LIST=${{ inputs.SYSTEMS }}
else
SYSTEMS_LIST='["CentOS_8", "AmazonLinux_2", "Ubuntu_22", "RHEL8"]'
SYSTEMS_LIST='["Ubuntu_22"]'
fi
echo "SYSTEMS_JSON=$(echo $SYSTEMS_LIST | jq -c '.')" >> $GITHUB_OUTPUT
echo "Systems JSON: $SYSTEMS_JSON"
Expand Down Expand Up @@ -135,7 +136,8 @@ jobs:
- name: Allocate cluster of EC2 instances
id: allocator_instance
run: |
instance_names=("wi1" "wi2" "wi3", "dashboard", "manager", "worker")
# instance_names=("wi1" "wi2" "wi3", "dashboard", "manager", "worker")
instance_names=($INSTANCE_NAMES)
inventory_file="$ALLOCATOR_PATH/inventory_all"
mkdir -p $ALLOCATOR_PATH
Expand Down Expand Up @@ -163,36 +165,36 @@ jobs:
# Add instance to corresponding group
if [[ $i -eq 0 ]]; then
echo "wi1 ansible_host=$ansible_host private_ip=$private_ip indexer_node_name=node-1" >> $inventory_file
echo "wi1 ansible_host=$ansible_host private_ip=$private_ip indexer_node_name=node-1 ansible_ssh_private_key_file=$ansible_ssh_private_key_file" >> $inventory_file
elif [[ $i -eq 1 ]]; then
echo "wi2 ansible_host=$ansible_host private_ip=$private_ip indexer_node_name=node-2" >> $inventory_file
echo "wi2 ansible_host=$ansible_host private_ip=$private_ip indexer_node_name=node-2 ansible_ssh_private_key_file=$ansible_ssh_private_key_file" >> $inventory_file
elif [[ $i -eq 2 ]]; then
echo "wi3 ansible_host=$ansible_host private_ip=$private_ip indexer_node_name=node-3" >> $inventory_file
echo "wi3 ansible_host=$ansible_host private_ip=$private_ip indexer_node_name=node-3 ansible_ssh_private_key_file=$ansible_ssh_private_key_file" >> $inventory_file
elif [[ $i -eq 3 ]]; then
echo "dashboard ansible_host=$ansible_host private_ip=$private_ip" >> $inventory_file
echo "dashboard ansible_host=$ansible_host private_ip=$private_ip ansible_ssh_private_key_file=$ansible_ssh_private_key_file" >> $inventory_file
elif [[ $i -eq 4 ]]; then
echo "manager ansible_host=$ansible_host private_ip=$private_ip" >> $inventory_file
echo "manager ansible_host=$ansible_host private_ip=$private_ip ansible_ssh_private_key_file=$ansible_ssh_private_key_file" >> $inventory_file
elif [[ $i -eq 5 ]]; then
echo "worker ansible_host=$ansible_host private_ip=$private_ip" >> $inventory_file
fi
if [[ $i -eq ${#instance_names[@]}-1 ]]; then
echo "[wi_cluster]" >> $inventory_file
echo "wi1" >> $inventory_file
echo "wi2" >> $inventory_file
echo "wi3" >> $inventory_file
echo "[all:vars]" >> $inventory_file
echo "ansible_ssh_user=$ansible_user" >> $inventory_file
echo "ansible_port=$ansible_port" >> $inventory_file
echo "ansible_ssh_private_key_file=$ansible_ssh_private_key_file" >> $inventory_file
echo "ansible_ssh_common_args='$ansible_ssh_common_args'" >> $inventory_file
echo "ansible_ssh_extra_args='-o StrictHostKeyChecking=no'" >> $inventory_file
echo "worker ansible_host=$ansible_host private_ip=$private_ip ansible_ssh_private_key_file=$ansible_ssh_private_key_file" >> $inventory_file
fi
) &
done
# Wait for all provisioning tasks to complete
wait
echo "" >> $inventory_file # blank line to separate groups
echo "[wi_cluster]" >> $inventory_file
echo "wi1" >> $inventory_file
echo "wi2" >> $inventory_file
echo "wi3" >> $inventory_file
echo "" >> $inventory_file
echo "[all:vars]" >> $inventory_file
echo "ansible_ssh_user=$ansible_user" >> $inventory_file
echo "ansible_port=$ansible_port" >> $inventory_file
echo "ansible_ssh_common_args='$ansible_ssh_common_args'" >> $inventory_file
echo "ansible_ssh_extra_args='-o StrictHostKeyChecking=no'" >> $inventory_file
- name: Save ALLOCATOR_PATH directory as artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -202,7 +204,6 @@ jobs:
uses: actions/checkout@v4
- name: Ansible Playbook run Wazuh Distributed Production Ready
run: |
# ansible-playbook ./.github/playbooks/aio-wazuh.yml \
ansible-playbook playbooks/wazuh-production-ready.yml -b -K \
-i $ALLOCATOR_PATH/inventory_all \
-l all \
Expand Down

0 comments on commit 5714f03

Please sign in to comment.