Skip to content

Commit

Permalink
Add ansible
Browse files Browse the repository at this point in the history
  • Loading branch information
mesudip committed May 9, 2024
1 parent b5fd880 commit 9090f69
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/build-and-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
name: Deploy app
runs-on: ubuntu-latest
env:
DOCKER_HOST: ssh://ec2-user@${{secrets.TEST_STACK_SERVER_IP }}
GRAFANA_ADMIN_PASSWORD: ${{ secrets.GRAFANA_ADMIN_PASSWORD }}
GRAFANA_SLACK_RECIPIENT: ${{ secrets.GRAFANA_SLACK_RECIPIENT }}
GRAFANA_SLACK_OAUTH_TOKEN: ${{ secrets.GRAFANA_SLACK_OAUTH_TOKEN }}
Expand All @@ -36,10 +35,13 @@ jobs:
with:
ssh-private-key: ${{ secrets.TEST_STACK_SSH_KEY }}

- name: Update images
working-directory: "./tests/test-infrastructure"

- name: Install Ansible
run: sudo apt-get update && sudo apt-get install -y ansible

- name: Run Ansible playbook
env:
SERVER_IP_ADDRESS: ${{ secrets.TEST_STACK_SERVER_IP }}
working-directory: ./tests/test-infrastructure
run: |
pwd
ls
set -x;
./build-and-deploy.sh update-images
ansible-playbook -i inventory.ini playbook.yml
2 changes: 2 additions & 0 deletions tests/test-infrastructure/inventory.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[server]
server1 ansible_host={{ lookup('env', 'SERVER_IP_ADDRESS') }} ansible_user=myuser
29 changes: 29 additions & 0 deletions tests/test-infrastructure/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
- name: Copy files and execute build-and-deploy.sh
hosts: servers
gather_facts: no
tasks:
- name: Copy files to the server
ansible.builtin.copy:
src: "{{ item }}"
dest: "/opt/govtool/{{ item }}"
mode: '0755'
with_items:
- build-and-deploy.sh
- build-images.sh
- configs_template/
- deploy.sh
- docker-compose-basic-services.yml
- docker-compose-cardano.yml
- docker-compose-govaction-loader.yml
- docker-compose-govtool.yml
- docker-compose-test.yml
- gen-configs.sh
- scripts/
- secrets_template/
become: yes
- name: Execute build-and-deploy.sh
ansible.builtin.shell: "/opt/govtool/build-and-deploy.sh update-images"
args:
chdir: "/opt/govtool"
become: yes

0 comments on commit 9090f69

Please sign in to comment.