Skip to content

Commit

Permalink
Update the workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ozennou committed Dec 25, 2024
1 parent 783f7eb commit 059f227
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/infra-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jobs:
retention-days: 1

ansible:
env:
ANSIBLE_HOST_KEY_CHECKING: False
defaults:
run:
working-directory: ./configs
Expand Down Expand Up @@ -101,6 +103,19 @@ jobs:
ROOT_PASSWD=${{ secrets.GITLAB_ROOT_PASSWD }}
RUNNER_REGISTRATION_TOKEN=${{ secrets.GITLAB_RUNNER_REGISTRATION_TOKEN }}
EOF
cat << EOF > inventory.ini
[gitlab-instance]
$(cat virtual_machines.ini | grep main_vm | awk -F' = "' '{print $2}' | sed 's/"$//' | tr -d '\n') ansible_user=ubuntu ansible_ssh_private_key_file=./private_key.pem
[gitlab-runner]
$(cat virtual_machines.ini | grep runner_vm | awk -F' = "' '{print $2}' | sed 's/"$//' | tr -d '\n') ansible_user=ubuntu ansible_ssh_private_key_file=./private_key.pem
EOF
cat inventory.ini
cat << EOF > gitlab.rb
external_url 'http://$(cat virtual_machines.ini | grep main_vm | awk -F' = "' '{print $2}' | sed 's/"$//' | tr -d '\n')'
gitlab_rails['initial_root_password'] = "${{ secrets.GITLAB_ROOT_PASSWD }}"
gitlab_rails['initial_shared_runners_registration_token'] = "${{ secrets.GITLAB_RUNNER_REGISTRATION_TOKEN }}"
EOF
cat gitlab.rb
- name: test
run: ls -la
- name: Run GitLab instance playbook
run: ansible-playbook -i inventory.ini Gitlab-instance.yml
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
*.tfstate.*
.env
.env2
configs/gitlab.rb
configs/gitlab.rb
configs/inventory.ini
test

0 comments on commit 059f227

Please sign in to comment.