-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (54 loc) · 1.52 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
name: Test
on:
push:
branch:
- "devops/fix*"
permissions:
id-token: write
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
Ansible:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Ansible
run: |
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
- name: Install boto
run: |
pipx inject ansible-core boto3
pipx inject ansible-core botocore
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
audience: sts.amazonaws.com.
role-to-assume: arn:aws:iam::381491931967:role/GitHubAction-EC2-RO
role-session-name: deploy-role-session
aws-region: us-east-2
- name: Prepare ssh key
shell: bash
env:
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
mkdir ~/.ssh
chmod 700 ~/.ssh
echo $SSH_KEY > ~/.ssh/glove.prv
chmod 600 ~/.ssh/glove.prv
- name: Run Ansible
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: glove.yml
directory: devops/ansible
configuration: |
[defaults]
inventory = inventory_aws_ec2.yml
key: ${{ secrets.SSH_PRIVATE_KEY }}
options: |
--inventory inventory_aws_ec2.yml