Añadir deploy-containers.yaml
This commit is contained in:
46
deploy-containers.yaml
Normal file
46
deploy-containers.yaml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
version: v1.0
|
||||||
|
name: "Deploy Multiple Ubuntu 24.04 Containers"
|
||||||
|
|
||||||
|
agent:
|
||||||
|
machine:
|
||||||
|
type: e2-standard-2
|
||||||
|
os_image: "ubuntu2204"
|
||||||
|
|
||||||
|
blocks:
|
||||||
|
- name: "Initialize Terraform"
|
||||||
|
task:
|
||||||
|
jobs:
|
||||||
|
- name: "Init Terraform"
|
||||||
|
commands:
|
||||||
|
- checkout
|
||||||
|
- sudo apt update && sudo apt install -y terraform incus-client
|
||||||
|
- terraform init
|
||||||
|
|
||||||
|
- name: "Deploy Multiple Containers"
|
||||||
|
task:
|
||||||
|
env_vars:
|
||||||
|
- name: TF_VAR_containers
|
||||||
|
value: '["web01", "db01", "proxy01"]'
|
||||||
|
jobs:
|
||||||
|
- name: "Terraform Apply"
|
||||||
|
commands:
|
||||||
|
- terraform apply -auto-approve
|
||||||
|
|
||||||
|
- name: "Verify Containers"
|
||||||
|
task:
|
||||||
|
jobs:
|
||||||
|
- name: "List Containers"
|
||||||
|
commands:
|
||||||
|
- incus list
|
||||||
|
- incus exec web01 -- hostname
|
||||||
|
- incus exec db01 -- lsb_release -a
|
||||||
|
- incus exec proxy01 -- uptime
|
||||||
|
|
||||||
|
- name: "Destroy (Manual)"
|
||||||
|
task:
|
||||||
|
run:
|
||||||
|
when: "manual"
|
||||||
|
jobs:
|
||||||
|
- name: "Destroy All"
|
||||||
|
commands:
|
||||||
|
- terraform destroy -auto-approve
|
||||||
Reference in New Issue
Block a user