-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.mise.toml
More file actions
174 lines (143 loc) · 5.03 KB
/
.mise.toml
File metadata and controls
174 lines (143 loc) · 5.03 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Mise configuration for UniFi Oracle Cloud deployment
# https://mise.jdx.dev
[tools]
terraform = "1.14.3"
python = "3.12"
pipx = "latest"
ansible = "13.2.0"
pre-commit = "latest"
terraform-docs = "latest"
[tasks.ansible-setup]
description = "Install Ansible collections"
run = "cd ansible && ansible-galaxy collection install -r requirements.yml"
[tasks.init]
description = "Initialize Terraform"
run = "cd terraform && terraform init"
[tasks.migrate_backend]
description = "Migrate Terraform state"
run = "cd terraform && terraform init -migrate-state"
[tasks.upgrade]
description = "Initialize Terraform with upgrade"
run = "cd terraform && terraform init --upgrade"
[tasks.plan]
description = "Plan Terraform deployment"
run = "cd terraform && terraform plan"
[tasks.deploy]
description = "🚀 Deploy complete UniFi infrastructure (ONE COMMAND!)"
run = "cd terraform && terraform apply -auto-approve"
[tasks.apply]
description = "Apply Terraform deployment with confirmation"
run = "cd terraform && terraform apply"
[tasks.destroy]
description = "Destroy Terraform infrastructure"
run = "cd terraform && terraform destroy"
[tasks.status]
description = "Check UniFi installation status"
run = """
IP=$(cd terraform && terraform output -raw instance_public_ip 2>/dev/null)
if [ -z "$IP" ]; then
echo "❌ Infrastructure not deployed yet. Run 'mise run deploy' first."
exit 1
fi
echo "🔍 Checking installation status on $IP..."
ssh -o StrictHostKeyChecking=no ubuntu@$IP 'cat /var/log/unifi-installation-complete.txt 2>/dev/null || echo "⏳ Installation still in progress..."'
"""
[tasks.logs]
description = "View UniFi installation logs in real-time"
run = """
IP=$(cd terraform && terraform output -raw instance_public_ip 2>/dev/null)
if [ -z "$IP" ]; then
echo "❌ Infrastructure not deployed yet. Run 'mise run deploy' first."
exit 1
fi
echo "📋 Showing installation logs from $IP (Ctrl+C to exit)..."
ssh -o StrictHostKeyChecking=no ubuntu@$IP 'tail -f /var/log/unifi-install.log'
"""
[tasks.ssh]
description = "SSH into the UniFi server"
run = """
IP=$(cd terraform && terraform output -raw instance_public_ip 2>/dev/null)
if [ -z "$IP" ]; then
echo "❌ Infrastructure not deployed yet. Run 'mise run deploy' first."
exit 1
fi
echo "🔐 Connecting to $IP..."
ssh ubuntu@$IP
"""
[tasks.url]
description = "Show UniFi web interface URL"
run = """
IP=$(cd terraform && terraform output -raw instance_public_ip 2>/dev/null)
if [ -z "$IP" ]; then
echo "❌ Infrastructure not deployed yet. Run 'mise run deploy' first."
exit 1
fi
echo ""
echo "🌐 UniFi OS Web Interface:"
echo " https://$IP:11443"
echo ""
"""
[tasks.ansible-inventory]
description = "Show Ansible inventory from Terraform state"
run = "cd ansible && ansible-inventory --list"
[tasks.ansible-graph]
description = "Show Ansible inventory graph"
run = "cd ansible && ansible-inventory --graph"
[tasks.ansible-ping]
description = "Test Ansible connectivity to UniFi server"
run = "cd ansible && ansible unifi_servers -m ping"
[tasks.ansible-run]
description = "Run Ansible playbook manually"
run = "cd ansible && ansible-playbook playbook.yml"
[tasks.ansible-check]
description = "Run Ansible playbook in check mode (dry-run)"
run = "cd ansible && ansible-playbook playbook.yml --check --diff"
[tasks.ansible-tags]
description = "List available Ansible tags"
run = "cd ansible && ansible-playbook playbook.yml --list-tags"
[tasks.pre-commit-install]
description = "Install pre-commit hooks"
run = "pre-commit install"
[tasks.pre-commit-run]
description = "Run pre-commit on all files"
run = "pre-commit run --all-files"
[tasks.pre-commit-update]
description = "Update pre-commit hooks"
run = "pre-commit autoupdate"
[tasks.lint]
description = "Run all linters (pre-commit + ansible-lint)"
run = """
echo "🔍 Running pre-commit hooks..."
pre-commit run --all-files
echo ""
echo "🔍 Running ansible-lint..."
cd ansible && ansible-lint
"""
[tasks.ansible-lint]
description = "Run Ansible linting"
run = "cd ansible && ansible-lint"
[tasks.backend-setup]
description = "🗄️ Setup OCI Object Storage backend for tfstate (recommended)"
run = """
echo "🗄️ Setting up OCI Object Storage backend for Terraform state..."
echo ""
echo "This will create a bucket in OCI Object Storage (Always Free)."
echo ""
cd terraform/backend-setup
if [ ! -f terraform.tfvars ]; then
echo "❌ terraform/backend-setup/terraform.tfvars not found."
echo " Copy terraform/backend-setup/terraform.tfvars.example to terraform/backend-setup/terraform.tfvars and fill in your values."
exit 1
fi
terraform init
terraform apply
echo ""
echo "📋 Follow the instructions above to complete backend configuration."
"""
[tasks.docs]
description = "Update Terraform documentation with terraform-docs"
run = "cd terraform && terraform-docs markdown table --output-file README.md --output-mode inject ."
[tasks.setup]
description = "Initial setup - run this first"
run = "mise install"
depends_post = ['ansible-setup','pre-commit-install']