Skip to content

Commit

Permalink
ci: how to setup custom testing machine
Browse files Browse the repository at this point in the history
  • Loading branch information
praiskup committed Sep 27, 2024
1 parent 26e11a0 commit 6ff1092
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
54 changes: 54 additions & 0 deletions mock/integration-tests/setup-playbook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Starting EC2 machine
--------------------

1. init git submodules

git submodule update --init --recursive

2. setup AWS vars like this (change fields appropriately):

cat > group_vars/all.yaml <<EOF
---
aws:
image: ami-004f552bba0e5f64f
profile: fedora-copr # you need credentials for this
ssh_key: praiskup
instance_type: t2.xlarge
security_group: mock-testing
root_volume_size: 60
infra_subnet: subnet-09c74a3e6420a206b
EOF

3. setup credentials/aws config:

cat ~/.aws/config
[profile fedora-copr]
region = us-east-1
output = table
$ cast ~/.aws/

cat ~/.aws/credentials
[fedora-copr]
aws_access_key_id=<the-key-id>
aws_secret_access_key=<the-secret-key>

4. start the machine

ansible-playbook spawn-test-machine-ec2.yaml

PLAY [Start new machine] *******************

TASK [create the testing mock vm in ec2] ***
changed: [localhost]

TASK [print ipv4] **************************
ok: [localhost] => {
"msg": [
"Instance ID: i-02f769285490cbb64",
"Network ID: eni-0298fa7a391ecc42e",
"Unusable Public IP: 107.20.103.13"
]
}

PLAY RECAP ********************************
localhost : ok=2 changed=1 unreachable=0 ...
2 changes: 1 addition & 1 deletion mock/integration-tests/setup-playbook/roles/fix-root-ssh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
amazon.aws.ec2_instance:
name: "testing-mock"
state: running
profile: fedora-copr
profile: "{{ aws.profile }}"
region: us-east-1
key_name: "{{ aws.ssh_key }}"
count: 1
Expand All @@ -17,7 +17,7 @@
detailed_monitoring: true
network:
assign_public_ip: true
vpc_subnet_id: "{{ infra_subnet }}"
vpc_subnet_id: "{{ aws.infra_subnet }}"
security_group: "{{ aws.security_group }}"
termination_protection: false
wait: true
Expand Down

0 comments on commit 6ff1092

Please sign in to comment.