From 284e86c4241403e6aac33d04030cdf887c55760e Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Mon, 31 Oct 2022 20:30:26 +0100 Subject: [PATCH] test drone check syntax --- .dockerignore | 1 + .drone.yml | 16 +++++++++------- Dockerfile | 9 +++++++++ inventory/group_vars/nas_vault | 10 +++++----- inventory/group_vars/registry | 1 + inventory/hosts | 1 + requirements.yml | 5 +---- scaleway-k8s/tasks/main.yml | 10 +++++----- server/files/docker-compose-registry.yml | 3 ++- server/tasks/deploy.yml | 2 +- server/tasks/main.yml | 12 ++++++------ 11 files changed, 41 insertions(+), 29 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9414382 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +Dockerfile diff --git a/.drone.yml b/.drone.yml index 9fc7f77..0192f10 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,11 +1,13 @@ kind: pipeline name: default +type: docker steps: -- name: check ansible syntax - image: plugins/ansible:3 - settings: - playbook: playbook.yml - galaxy: requirements.yml - inventory: inventory - syntax_check: true +- 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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c3a7672 --- /dev/null +++ b/Dockerfile @@ -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 diff --git a/inventory/group_vars/nas_vault b/inventory/group_vars/nas_vault index c65113f..b244e8f 100644 --- a/inventory/group_vars/nas_vault +++ b/inventory/group_vars/nas_vault @@ -1,6 +1,6 @@ $ANSIBLE_VAULT;1.1;AES256 -35333863396561393462653263323133343233346534616138616530643066323161656534653738 -3335306466663636623236383435663337393466633437660a303961663331653463343933353966 -35636161393663386137306561613965653438626432323865323233636662653333616532636665 -3562333936366238640a646262373233363665366437653032303238313266356138343239303936 -36663531303061663763653637333365303664666563353631303435633462343537 +32373966623936633630666638373762306130326162383539633032616330323831643063613465 +6633346330663030353837306235353133356161633236660a666230326236316537363130353733 +61373037313536373364613731386137643931303365373737613433653835386533653638393037 +3134666533313136330a626331313231613163323162663436653261623762656632373434383566 +34353930626630643762303530363665636161316163313031366238373362376461 diff --git a/inventory/group_vars/registry b/inventory/group_vars/registry index b18e8ac..1aff19b 100644 --- a/inventory/group_vars/registry +++ b/inventory/group_vars/registry @@ -4,6 +4,7 @@ project_src: "/home/valentin/registry" project_directory: - "{{ project_src }}" + docker_compose_file: "docker-compose-registry.yml" diff --git a/inventory/hosts b/inventory/hosts index 96d8ffc..093d215 100644 --- a/inventory/hosts +++ b/inventory/hosts @@ -16,6 +16,7 @@ valentin-nas [registry] valentin-nas + [drone] drone-host diff --git a/requirements.yml b/requirements.yml index 421159b..5e5c1ca 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,7 +1,4 @@ -/home/valentin/.ansible/collections/ansible_collections: - community.docker: - version: 3.1.0 -/usr/lib/python3.10/site-packages/ansible_collections: +collections: amazon.aws: version: 3.4.0 ansible.netcommon: diff --git a/scaleway-k8s/tasks/main.yml b/scaleway-k8s/tasks/main.yml index 7560b80..80fb2c6 100644 --- a/scaleway-k8s/tasks/main.yml +++ b/scaleway-k8s/tasks/main.yml @@ -1,15 +1,15 @@ - name: Create folder for image - ansible.builtin.import_tasks: create-build.yml + import_tasks: create-build.yml tags: ["create-build"] - name: Create cluster k8s scaleway via terraform - ansible.builtin.import_tasks: create-cluster.yml + import_tasks: create-cluster.yml tags: ["create-cluster"] - name: Get id Cluster - ansible.builtin.import_tasks: kubeconfig.yml + import_tasks: kubeconfig.yml tags: ["create-cluster", "kubeconfig"] - name: Destroy cluster k8s scaleway via terraform - ansible.builtin.import_tasks: destroy-cluster.yml - tags: ["destroy-cluster"] \ No newline at end of file + import_tasks: destroy-cluster.yml + tags: ["destroy-cluster"] diff --git a/server/files/docker-compose-registry.yml b/server/files/docker-compose-registry.yml index 28f1b96..fd1d92f 100644 --- a/server/files/docker-compose-registry.yml +++ b/server/files/docker-compose-registry.yml @@ -7,5 +7,6 @@ services: - "5000:5000" environment: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data + volumes: - - ./data:/data + - ./data:/data diff --git a/server/tasks/deploy.yml b/server/tasks/deploy.yml index f2114f8..061390a 100644 --- a/server/tasks/deploy.yml +++ b/server/tasks/deploy.yml @@ -32,4 +32,4 @@ - name: Copy docker compose server file copy: src: "{{ docker_compose_file }}" - dest: "{{ project_src }}/docker-compose.yml" \ No newline at end of file + dest: "{{ project_src }}/docker-compose.yml" diff --git a/server/tasks/main.yml b/server/tasks/main.yml index c4cd002..13efea6 100644 --- a/server/tasks/main.yml +++ b/server/tasks/main.yml @@ -3,22 +3,22 @@ - name: Debug role - ansible.builtin.import_tasks: debug.yml + import_tasks: debug.yml tags: ["debug"] - name: Deploy services - ansible.builtin.import_tasks: deploy.yml + import_tasks: deploy.yml tags: ["deploy", "create"] - name: Start services - ansible.builtin.import_tasks: start.yml + import_tasks: start.yml tags: ["deploy", "start"] - name: stop services - ansible.builtin.import_tasks: stop.yml + import_tasks: stop.yml tags: ["destroy", "stop"] - name: Remove services - ansible.builtin.import_tasks: remove.yml - tags: ["destroy"] \ No newline at end of file + import_tasks: remove.yml + tags: ["destroy"]