Skip to content

Commit 981411f

Browse files
committedJul 18, 2023
learning ansible stuff
1 parent 6039dee commit 981411f

File tree

7 files changed

+116
-2
lines changed

7 files changed

+116
-2
lines changed
 

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
kubectl
2+
old/

‎ansible/inventory.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
virtualmachines:
2+
hosts:
3+
hetzner_vps_INITIAL:
4+
ansible_host: 5.75.186.193
5+
ansible_user: root
6+
hetzner_vps:
7+
ansible_host: 5.75.186.193
8+
ansible_user: al
9+
ansible_port: 6477
10+
11+
# virtualmachines:
12+
# hosts:
13+
# hetzner_vps:
14+
# ansible_host: 5.75.186.193
15+
# vars:
16+
# ansible_port: 6477
17+
# ansible_user: al

‎ansible/setup/bootstrap.yml

Whitespace-only changes.

‎ansible/setup/setup.yml

Whitespace-only changes.

‎ansible/setup/site.yml

Whitespace-only changes.

‎ansible/site.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- name: change the initial SSH access
2+
hosts: hetzner_vps_INITIAL
3+
gather_facts: false
4+
remote_user: root
5+
vars:
6+
vps_host: "{{ hostvars['hetzner_vps'].ansible_host }}"
7+
vps_port: "{{ hostvars['hetzner_vps'].ansible_port }}"
8+
vps_user: "{{ hostvars['hetzner_vps'].ansible_user }}"
9+
10+
tasks:
11+
- name: Check ansible user
12+
command: echo {{ vps_user }}@{{ vps_host }} -p {{ vps_port }} OK
13+
delegate_to: localhost
14+
connection: local
15+
changed_when: false
16+
failed_when: "'OK' not in check_ansible_user.stdout"
17+
register: "check_ansible_user"

‎readme.md

+80-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
1-
## infrastructure
1+
## Infrastructure
22

3-
infrastructure-as-code lab, hosting my personal projects
3+
Infrastructure-as-code lab, hosting my personal projects
4+
5+
## getting started
6+
7+
Insall ansible
8+
9+
```bash
10+
python3 -m pip install --user ansible
11+
```
12+
13+
Configure the machine ip in `inventory.yml`. You must set it both in
14+
`virtualmachines` and `virtualmachines_INITIAL`, which is the initial way
15+
ssh access is configured, that the first ansible playbook will change
16+
17+
Test that the INITIAL machines are accessible
18+
19+
```bash
20+
ansible virtualmachines_INITIAL -m ping -i inventory.yml
21+
```
22+
23+
### Roadmap
24+
25+
#### provisioning
26+
27+
The ubuntu machine provisioning will be handled manually. I don't need fancy stuff
28+
29+
#### machine
30+
31+
write ansible files to configure the host ubuntu machine.
32+
33+
Initial step (INITIAL host,port=22,user=root): add ansible user, change ssh port
34+
35+
all other steps (host, port=xxxx,user=ansible)
36+
- remove root login
37+
- add "al" user, define keys, docker group
38+
- install docker
39+
- install database
40+
41+
42+
#### References
43+
44+
https://docs.ansible.com/ansible/latest/getting_started/index.html
45+
46+
47+
48+
49+
### Old roadmap
50+
51+
#### k8s files
52+
53+
define all the k8s infrastructure in a reproducible way:
54+
55+
- introspection services, grafana, loki, prometheus.
56+
- analytics
57+
- database web management (to find, something like phpmyadmin but serious)
58+
- argocd
59+
- secrets management
60+
- secrets management integrated into argo (i put a link to a tutorial in telegram)
61+
62+
63+
The idea is that all the personal projects will be managed via argo, secrets and databases will be configured manually from the respective admin panels.
64+
65+
The rest of the stuff on the cluster, such as the admin interfaces, argo, grafana etch will be defined in this repository.
66+
Ideally, the charts and manifests in this repo should be managed via terraform.
67+
68+
#### machine
69+
70+
write ansible files to configure the host ubuntu machine.
71+
72+
- define ssh users and keys
73+
- install mariadb
74+
- install k3s
75+
76+
the idea is that mariadb (an other future databases) will be installed outside of k3s, but on the same machine, listening on the loopback interface. The access will be provided via a Service in the namespace external-services
77+
78+
79+
#### provisioning
80+
81+
The ubuntu machine provisioning will be handled manually. I don't need fancy stuff

0 commit comments

Comments
 (0)
Please sign in to comment.