Skip to content

Commit 32816ee

Browse files
committed
yaaaah yeet
1 parent 09ac099 commit 32816ee

6 files changed

Lines changed: 90 additions & 7 deletions

File tree

.woodpecker/build.yaml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ when:
44

55
steps:
66

7-
- name : Deploy With Ansible
8-
image: woodpeckerci/plugin-ansible
9-
commands:
10-
- apk add make
11-
- cd infrastructure && make deploy-app
12-
137
- name: Build dashboard
148
image: woodpeckerci/plugin-docker-buildx:6.0.0
159
settings:
@@ -46,6 +40,42 @@ steps:
4640
password:
4741
from_secret: docker_password
4842

43+
- name : Deploy With Ansible
44+
image: woodpeckerci/plugin-ansible
45+
settings:
46+
playbook: infrastructure/deploy/deploy-databuddy.yaml
47+
diff: false
48+
inventory: infrastructure/inventory.ini
49+
syntax_check: true
50+
user: root
51+
private_key:
52+
from_secret: ansible_private_key
53+
galaxy: infrastructure/requirements.yaml
54+
extra_vars:
55+
ipinfo_token:
56+
from_secret: ipinfo_token
57+
ai_api_key:
58+
from_secret: ai_api_key
59+
better_auth_url:
60+
from_secret: better_auth_url
61+
better_auth_secret:
62+
from_secret: better_auth_secret
63+
github_client_id:
64+
from_secret: github_client_id
65+
github_client_secret:
66+
from_secret: github_client_secret
67+
google_client_id:
68+
from_secret: google_client_id
69+
google_client_secret:
70+
from_secret: google_client_secret
71+
opr_api_key:
72+
from_secret: opr_api_key
73+
docker_username:
74+
from_secret: docker_username
75+
docker_password:
76+
from_secret: docker_password
77+
version: ${CI_COMMIT_TAG}
78+
4979

5080

5181

infrastructure/add-ssh-keys.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
- hosts: "{{ hosts_group }}"
3+
name: Add SSH keys on Nodes
4+
remote_user: ubuntu
5+
gather_facts: true
6+
become: true
7+
vars:
8+
hosts_group: dev-nodes
9+
public_keys: "./dev-access"
10+
keys_glob : "{{public_keys}}/*.pub"
11+
all_keys_glob: "./public-keys/*.pub"
12+
13+
14+
tasks:
15+
- name: Read Files
16+
set_fact:
17+
read_keys: "{{read_keys | default([]) | union([lookup('file', item)])}}"
18+
delegate_to: localhost
19+
become: false
20+
with_fileglob: "{{keys_glob}}"
21+
22+
- name: Read All Files
23+
set_fact:
24+
all_keys: "{{all_keys | default([]) | union([lookup('file', item)])}}"
25+
delegate_to: localhost
26+
become: false
27+
with_fileglob: "{{all_keys_glob}}"
28+
29+
- name: Set up multiple authorized keys
30+
ansible.posix.authorized_key:
31+
user: ubuntu
32+
state: present
33+
key: "{{ item }}"
34+
with_items: "{{read_keys}}"
35+
36+

infrastructure/ansible-key.pub

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDBke7DXMRx2oFNT8DSKOSnKijJ27B19OCJnk3+K0LiYgzEqqSfD52nn3QlL3f1VPF5MWXWYvZEfXvZCkh0zxkTged1W74Ws68S8wZMA7WJNWoEcZ09Qw5QDkR1dIAUic8Lv+d3R2RL6SRlfd92EvGnLMdMrs5aMnu+R8JmgtG92EEHCXrZoxPtqvnNSLal7MYze7MabjsT9FzjSSKFra3c/LzDcvTPeddERegIXQGAyoVR84IOJh6MxeVGg/i9HyLBz35AkScnsbCF7bwX6bYL7/tzt9VZVbMLiP/Uv07Xncn8jxZI0BLloUYjgLcRLQOzbCnuGeVLAurecPnOKmp/a0AhQnqdS4AsmMturQ096Jr2bHZpiRVKW1st3YWM4Frs8CQrksuiRmge1ip+R4uaX65mBD5tV4UsV0s6yXa/9vT9uznT5pstjp3yQMl3bLD/CnN8x6CysK75TQ4zcASTyXUFfrbzVLQlpBn6RhY/CEb0WloHfLdrAisZ/wm4+c2caE6/6qfgITUH+KxVnibDmBbkDnNySBzPhYEdcMziplwCYoIv9k2jP1FWwgpn0KA1zd++LrdGdgvXCX7izuF42WmLqQ0zZ76FlWudmXnDZy/tKyd5lB6Etl4oROlzyGTEF6ZmEHV4lmddGA7YT52Eh5Xo/htURhkcrmVfFTirXw== root@tool001

infrastructure/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ deploy-registry: install-dependencies
3636
cd registry && ansible-playbook --timeout 60 --ssh-common-args="-i $(SSH_PRIVATE_KEY) -o ServerAliveInterval=15" -i ../inventory.ini deploy-registry.yaml
3737

3838
deploy-app: install-dependencies
39-
cd deploy && ansible-playbook --timeout 60 --ssh-common-args="-i $(SSH_PRIVATE_KEY) -o ServerAliveInterval=15" -i ../inventory.ini deploy-databuddy.yaml \
39+
ansible-playbook --timeout 60 --ssh-common-args="-i $(SSH_PRIVATE_KEY) -o ServerAliveInterval=15" -i ./inventory.ini deploy/deploy-databuddy.yaml \
4040
--extra-vars "ipinfo_token=$$IPINFO_TOKEN" \
4141
--extra-vars "ai_api_key=$$AI_API_KEY" \
4242
--extra-vars "better_auth_url=$$BETTER_AUTH_URL" \

infrastructure/requirements.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
collections:
3+
- name: ansible.posix
4+
source: https://galaxy.ansible.com
5+
6+
- name: community.docker
7+
source: https://galaxy.ansible.com
8+
9+
- name: community.general
10+
source: https://galaxy.ansible.com

infrastructure/setup-nodes.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,10 @@
190190
test_command: systemctl is-active docker
191191
when: (resultHard.changed or resultSoft.changed)
192192
throttle: 1
193+
194+
- name: Add Ansible Public Key
195+
ansible.posix.authorized_key:
196+
user: root
197+
state: present
198+
key: "{{lookup('file', 'ansible-key.pub') }}"
193199

0 commit comments

Comments
 (0)