Skip to content

Commit 2e467f0

Browse files
committed
ansible - setup terraform, minikube, localstack
1 parent bebec0b commit 2e467f0

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

ansible/setup_local_cloud.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
- name: Setup environment for Terraform, LocalStack, and Minikube with Podman
3+
hosts: localhost
4+
become: yes
5+
tasks:
6+
7+
# Install dependencies
8+
- name: Install system dependencies
9+
apt:
10+
name:
11+
- python3-pip
12+
- unzip
13+
- curl
14+
- podman
15+
- conntrack
16+
state: present
17+
update_cache: yes
18+
19+
# Install Terraform
20+
- name: Download Terraform binary
21+
get_url:
22+
url: "https://releases.hashicorp.com/terraform/{{ terraform_version }}/terraform_{{ terraform_version }}_linux_amd64.zip"
23+
dest: /tmp/terraform.zip
24+
25+
- name: Unzip Terraform binary
26+
unarchive:
27+
src: /tmp/terraform.zip
28+
dest: /usr/local/bin/
29+
remote_src: yes
30+
31+
- name: Ensure Terraform is executable
32+
file:
33+
path: /usr/local/bin/terraform
34+
mode: '0755'
35+
36+
# Install LocalStack (using Podman)
37+
- name: Pull LocalStack container with Podman
38+
command: podman pull localstack/localstack:latest
39+
40+
- name: Start LocalStack container with Podman
41+
command: podman run -d -p 4566:4566 --name localstack localstack/localstack
42+
43+
# Install Minikube
44+
- name: Download Minikube
45+
get_url:
46+
url: "https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64"
47+
dest: /usr/local/bin/minikube
48+
mode: '0755'
49+
50+
# Verify installation of Minikube
51+
- name: Start Minikube (using Podman driver)
52+
command: minikube start --driver=podman
53+
register: minikube_start
54+
ignore_errors: yes
55+
56+
- name: Minikube start failed, install conntrack
57+
apt:
58+
name: conntrack
59+
state: present
60+
when: "'conntrack' in minikube_start.stderr"
61+
62+
- name: Restart Minikube after installing conntrack
63+
command: minikube start --driver=podman
64+
when: "'conntrack' in minikube_start.stderr"
65+
66+
vars:
67+
terraform_version: "1.5.7" # Adjust version as needed
68+

0 commit comments

Comments
 (0)