Compare commits

..

9 Commits

Author SHA1 Message Date
284e86c424 test drone check syntax 2022-10-31 20:30:26 +01:00
1caaac3485 add drone yml
Some checks reported errors
continuous-integration/drone Build was killed
continuous-integration/drone/push Build was killed
2022-10-28 21:33:15 +02:00
372f1d7c18 add debug message 2022-10-28 20:20:16 +02:00
c26a6c6f84 fix url 2022-10-28 17:38:56 +02:00
e4ee762c65 add drone groups 2022-10-28 17:35:49 +02:00
91d441b38e remove localhost from db group 2022-10-20 17:05:48 +02:00
42f2a14d87 add passwordé 2022-10-20 17:00:58 +02:00
93eca7fec9 fix password 2022-10-20 16:56:51 +02:00
541eda55f6 Merge pull request 'k8s-deploy' (#2) from k8s-deploy into master
Reviewed-on: #2
2022-10-20 14:52:28 +00:00
20 changed files with 189 additions and 48 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
Dockerfile

13
.drone.yml Normal file
View File

@@ -0,0 +1,13 @@
kind: pipeline
name: default
type: docker
steps:
- name: check syntax ansible
image: v4l3n71n/covas:latest
pull: if-not-exists
commands:
- ansible-playbook -i inventory --syntax-check playbook.yml
image_pull_secrets:
- dockerconfig

9
Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM debian:bookworm-slim
RUN apt-get update --yes && apt-get upgrade --yes && apt-get install --yes python3 python3-pip && rm -rf /var/lib/apt/lists/*
RUN groupadd -r ansible && useradd -m -r -g ansible ansible
USER ansible
RUN pip install ansible
WORKDIR /home/ansible
ENV PATH="${PATH}:/home/ansible/.local/bin"
COPY . /home/ansible
RUN ansible-galaxy install -vvvv -r requirements.yml

View File

@@ -1,3 +1,4 @@
msg: db
postgres_url: db.valczeryba.ovh postgres_url: db.valczeryba.ovh
postgres_db: toto postgres_db: toto
postgres_port: 54321 postgres_port: 54321

View File

@@ -1,14 +1,15 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
30326462626436373330386637633864316430623235306239353439313932383964646435393965 39326362343932646638333238366563643865333035666231336238353131643433313237373031
3662326631306134363862626638616330633765666538360a323264646135393935343434343362 3732373733343264303039653534306461623661333266630a373363646661393764323139366266
36666566316465383833386433623565373837353233366435346633313566623361653937306336 39326432626434343230613334386266613030313862623436623335343734343565393831376263
6362383331643665300a393561643837376461326663663235343434363438623637306263626163 3131346166303836310a663066643333613866303538653066336366353966656662333332646639
38336162383331383732643765323763656130653432386534376335336338663663363439666361 33373134366662323632613465316465326530363662326437633630306164393438303137663730
31306530666264323130333561356564626536643533356337383631613534383730666338313664 37333065633230663862306364356161323131653662633339353361383437346339346262383139
34626261616430623063323836616130383335383965326239636362616531623565323734613532 64363634333364363666373636373037386265383063393938356466623237313966633538336138
33313830663666633432666135346234643834316239633132383862393636623230316532616365 61346639313535323730323834373230373733396661386163643531356465343532323266306335
30336564306336393064613330336436363631316236353237343838396637353735356461323331 38656232626432323737663030613130323536396266623332326130396463333434633363383139
34343637336532373539663565666337383837373235613734303831376636303361376533346333 37636630623263383933353066333736346162376162336239376530316533663936363062616131
32316430613936366464383832376237633036353737353566613638396236316664356638373635 30636437353963633138353838626532646238363935343764623530613139393564643464653538
35303239353937316236323339633335373761623032313231383937306236303861306265646333 61373964373063633331653131363663333230663239633764636333363435646433643637323664
65633638623065303761646562373936336235373533333265643534616663343538 66666336386464663231393836613862613935373465303331353563656361386363316438393662
3530383833303736656536363238626465663330396430636332

View File

@@ -0,0 +1,22 @@
drone_gitea_server: https://git.valczeryba.ovh
drone_server_host: drone.valczeryba.ovh:8000
drone_agents_enabled: true
drone_server_proto: http
drone_tls_autocert: false
drone_open: false
drone_host: http://localhost:8000
drone_rpc_server: drone-server:8000
msg: drone
project_src: "/home/valentin/drone"
project_directory:
- "{{ project_src }}"
project_env: env-drone.j2
docker_compose_file: "docker-compose-drone.yml"
ports_tcp:
- 8000
- 9000

View File

@@ -0,0 +1,18 @@
$ANSIBLE_VAULT;1.1;AES256
33363236363632653263383164663339323738366635613164353231396462303361333135623330
3564623639306161626331643662366339663465313132370a636136316366353434353035346138
32393263626430326234626235666137306262666134656232316465626563633535373732643838
3861303734656165630a646433623162393563303862393661303434356234643638303030646432
33386130626163653965353732313164373239303366626433393566343638343362633234313339
63323532613733353538303038663632623932366238343132356536396165636137633036313533
62396134303862623733323639633134323838366164363937626138386265643465356464366565
34303438383838656632383462366162663538353430646165643339383261643063373431383364
38646239613465356337306636306639336164623761666165616663626635343130653230656162
65396561343638366532313062363066663838346337356463316331336133336234653334613830
66326337633038623036613430316662316432613962303337663430643531653665633264343564
39383564633432643039306236613633643236646163353831346632653764633436336237346433
33306136346235386465356630386333646366663037386230306261346161303938633032373361
63306431306439373037343663616263373037386235303665643635336430346139653165636634
63323634306333663030383431363437383966633461333432393636613863306134386162326664
36376361343738653531623137326266663635633633323239633263383761616538656535343039
6435

View File

@@ -1,10 +1,11 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
38396665356139383861356137373362393834373765663937373730333434356565383864333137 30366237393836333338316164656633656435383866666462663830643463633064356261396431
3763386361323938326462393632346565386432336531620a616261656133323236343464303837 3066613335326464373833346430373663333736353537630a653934316366383165346238663134
39613966333435393336396361666337306438393138363961336462383666326363326439373762 30376439373634323636613566373534353138653964613236326464653662306136653964313861
6139623462323133330a646432336365666164643435383430616137313130646137623463373636 6135623361346639650a646533383761393435303833336138346164633161613739323765323664
32313561383838366437633634376434616438633665363465626633633537383435616537336339 65623039633039343039303931626138316132613433666136633336326433653561343761316363
64313836613730613135363739363536356362373762313431353938653738613666313966393163 66666230343165383130353939303633623264663161663030336533663437363630383565353064
33336234363964633633663431353966666530353432643461656336356166393837316634313164 35376633323564623361613663356230663664323261383564653433656638306432343132343631
65653033636338363563666363326433636163323363656530323834303464356136346163353466 32386232316234643464326533303065653535633064393438663931336334373965313064386532
3533 66306664303937356636366564623830623764386136663830636634326438373963666134613430
6530323937303637393934376466396565343133613736663166

View File

@@ -1,6 +1,6 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
35333863396561393462653263323133343233346534616138616530643066323161656534653738 32373966623936633630666638373762306130326162383539633032616330323831643063613465
3335306466663636623236383435663337393466633437660a303961663331653463343933353966 6633346330663030353837306235353133356161633236660a666230326236316537363130353733
35636161393663386137306561613965653438626432323865323233636662653333616532636665 61373037313536373364613731386137643931303365373737613433653835386533653638393037
3562333936366238640a646262373233363665366437653032303238313266356138343239303936 3134666533313136330a626331313231613163323162663436653261623762656632373434383566
36663531303061663763653637333365303664666563353631303435633462343537 34353930626630643762303530363665636161316163313031366238373362376461

View File

@@ -1,9 +1,10 @@
msg: registry
project_src: "/home/valentin/registry" project_src: "/home/valentin/registry"
project_directory: project_directory:
- "{{ project_src }}" - "{{ project_src }}"
docker_compose_file: "docker-compose-registry.yml" docker_compose_file: "docker-compose-registry.yml"

View File

@@ -1,10 +1,10 @@
vps ansible_connection=ssh ansible_host=51.222.107.37 ansible_port=2424 ansible_user=valentin vps ansible_connection=ssh ansible_host=51.222.107.37 ansible_port=2424 ansible_user=valentin
valentin-nas ansible_connection=ssh ansible_host=151.80.37.38 ansible_port=2424 ansible_user=valentin valentin-nas ansible_connection=ssh ansible_host=151.80.37.38 ansible_port=2424 ansible_user=valentin
drone-host ansible_connection=ssh ansible_host=151.80.37.38 ansible_port=2424 ansible_user=valentin
localhost ansible_host=127.0.0.1 localhost ansible_host=127.0.0.1
[db] [db]
vps vps
localhost
[db_vault:children] [db_vault:children]
db db
@@ -12,8 +12,16 @@ db
[nas] [nas]
valentin-nas valentin-nas
[registry:children]
nas [registry]
valentin-nas
[drone]
drone-host
[drone_vault:children]
drone
[nas_vault:children] [nas_vault:children]
nas nas

View File

@@ -1,9 +1,10 @@
--- ---
- hosts: registry db - hosts: registry db drone
remote_user: valentin remote_user: valentin
roles: roles:
- server - server
- hosts: local - hosts: local
remote_user: valentin remote_user: valentin
roles: roles:

View File

@@ -1,7 +1,4 @@
/home/valentin/.ansible/collections/ansible_collections: collections:
community.docker:
version: 3.1.0
/usr/lib/python3.10/site-packages/ansible_collections:
amazon.aws: amazon.aws:
version: 3.4.0 version: 3.4.0
ansible.netcommon: ansible.netcommon:

View File

@@ -1,15 +1,15 @@
- name: Create folder for image - name: Create folder for image
ansible.builtin.import_tasks: create-build.yml import_tasks: create-build.yml
tags: ["create-build"] tags: ["create-build"]
- name: Create cluster k8s scaleway via terraform - name: Create cluster k8s scaleway via terraform
ansible.builtin.import_tasks: create-cluster.yml import_tasks: create-cluster.yml
tags: ["create-cluster"] tags: ["create-cluster"]
- name: Get id Cluster - name: Get id Cluster
ansible.builtin.import_tasks: kubeconfig.yml import_tasks: kubeconfig.yml
tags: ["create-cluster", "kubeconfig"] tags: ["create-cluster", "kubeconfig"]
- name: Destroy cluster k8s scaleway via terraform - name: Destroy cluster k8s scaleway via terraform
ansible.builtin.import_tasks: destroy-cluster.yml import_tasks: destroy-cluster.yml
tags: ["destroy-cluster"] tags: ["destroy-cluster"]

View File

@@ -0,0 +1,51 @@
version: '3.5'
services:
drone-server:
image: drone/drone:2
ports:
- 8000:80
- 9000:443
networks:
- drone
volumes:
- ./drone-data:/var/lib/drone/
- /var/run/docker.sock:/var/run/docker.sock
env_file:
- .env
restart: always
environment:
- DRONE_GITHUB_SKIP_VERIFY=true
- DRONE_AGENTS_ENABLED=true
- DRONE_SERVER_PROTO=http
- DRONE_TLS_AUTOCERT=false
- DRONE_OPEN=false
- DRONE_HOST=http://drone.valczeryba.ovh:8000
- DRONE_GITHUB=true
# Variables below set via drone.env file
# - DRONE_USER_CREATE=
# - DRONE_USER_FILTER=
# - DRONE_GITHUB_CLIENT_ID=
# - DRONE_GITHUB_CLIENT_SECRET=
# - DRONE_RPC_SECRET=
drone-agent:
image: drone/agent:1.2.1
command: agent
restart: always
depends_on:
- drone-server
networks:
- drone
volumes:
- /var/run/docker.sock:/var/run/docker.sock
env_file:
- .env
environment:
- DRONE_RPC_SERVER=drone-server:8000
# Variables below set via drone.env file
# - DRONE_RPC_SECRET=
networks:
drone:
name: drone_network

View File

@@ -7,5 +7,6 @@ services:
- "5000:5000" - "5000:5000"
environment: environment:
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
volumes: volumes:
- ./data:/data - ./data:/data

3
server/tasks/debug.yml Normal file
View File

@@ -0,0 +1,3 @@
- name: debug
debug:
msg: "coucou {{ msg }}"

View File

@@ -32,4 +32,4 @@
- name: Copy docker compose server file - name: Copy docker compose server file
copy: copy:
src: "{{ docker_compose_file }}" src: "{{ docker_compose_file }}"
dest: "{{ project_src }}/docker-compose.yml" dest: "{{ project_src }}/docker-compose.yml"

View File

@@ -1,19 +1,24 @@
--- ---
# tasks file for server # tasks file for server
- name: Debug role
import_tasks: debug.yml
tags: ["debug"]
- name: Deploy services - name: Deploy services
ansible.builtin.import_tasks: deploy.yml import_tasks: deploy.yml
tags: ["deploy", "create"] tags: ["deploy", "create"]
- name: Start services - name: Start services
ansible.builtin.import_tasks: start.yml import_tasks: start.yml
tags: ["deploy", "start"] tags: ["deploy", "start"]
- name: stop services - name: stop services
ansible.builtin.import_tasks: stop.yml import_tasks: stop.yml
tags: ["destroy", "stop"] tags: ["destroy", "stop"]
- name: Remove services - name: Remove services
ansible.builtin.import_tasks: remove.yml import_tasks: remove.yml
tags: ["destroy"] tags: ["destroy"]

View File

@@ -0,0 +1,8 @@
# Drone secret key, used for private communication between agents and web UI
DRONE_USER_CREATE=
DRONE_USER_FILTER= {{ drone_user_filter }}
DRONE_GITEA_SERVER={{ drone_gitea_server }}
DRONE_GITEA_CLIENT_ID={{ drone_gitea_client_id }}
DRONE_GITEA_CLIENT_SECRET={{ drone_gitea_client_secret }}
DRONE_RPC_SECRET={{ drone_rpc_secret }}
DRONE_SERVER_HOST={{ drone_server_host }}