From 75b7f2fa3d6ebd700803941ae48fcfa85b0e8817 Mon Sep 17 00:00:00 2001 From: shockrah Date: Mon, 26 May 2025 01:10:00 -0700 Subject: [PATCH] Unreal amounts of linter fixes --- .gitea/workflows/ansible-lint.yaml | 2 +- ansible/inventory.yaml | 2 +- ansible/linter.yaml | 2 +- ansible/local-setup-admin-user.yaml | 7 ++-- ansible/nuc.yaml | 3 +- ansible/proxy.yaml | 5 +-- ansible/roles/base/tasks/main.yaml | 2 +- ansible/roles/base/tasks/nomad.yaml | 43 ++++++++++++------------ ansible/roles/base/vars/main.yaml | 1 - ansible/roles/nomad/tasks/main.yaml | 4 ++- ansible/roles/proxy/vars/main.yaml | 2 +- infra/containers/docker-compose.yaml | 40 ---------------------- infra/containers/readme.md | 29 ---------------- infra/containers/sanity-nginx/Dockerfile | 4 --- infra/containers/sanity-nginx/default | 15 --------- 15 files changed, 39 insertions(+), 122 deletions(-) delete mode 100644 infra/containers/docker-compose.yaml delete mode 100644 infra/containers/readme.md delete mode 100644 infra/containers/sanity-nginx/Dockerfile delete mode 100644 infra/containers/sanity-nginx/default diff --git a/.gitea/workflows/ansible-lint.yaml b/.gitea/workflows/ansible-lint.yaml index e216b1e..72e4d5d 100644 --- a/.gitea/workflows/ansible-lint.yaml +++ b/.gitea/workflows/ansible-lint.yaml @@ -10,6 +10,6 @@ jobs: steps: - name: Checkout repo content uses: actions/checkout@v4 - - run: ansible-lint + - run: ansible-lint -c linter.yaml working-directory: ansible/ diff --git a/ansible/inventory.yaml b/ansible/inventory.yaml index 7fc793a..8808b7d 100644 --- a/ansible/inventory.yaml +++ b/ansible/inventory.yaml @@ -1,3 +1,3 @@ nigel: hosts: - nigel.local: \ No newline at end of file + nigel.local: diff --git a/ansible/linter.yaml b/ansible/linter.yaml index 05dd6a0..5b49ae0 100644 --- a/ansible/linter.yaml +++ b/ansible/linter.yaml @@ -1,4 +1,4 @@ --- skip_list: - role-name - - var-naming[no-role-prefix] \ No newline at end of file + - var-naming[no-role-prefix] diff --git a/ansible/local-setup-admin-user.yaml b/ansible/local-setup-admin-user.yaml index 2a0e4c6..31e8218 100644 --- a/ansible/local-setup-admin-user.yaml +++ b/ansible/local-setup-admin-user.yaml @@ -2,14 +2,15 @@ # The rest of the role stuff is meant to be ran as the admin user that # this playbook creates for us --- -- hosts: nigel.local +- name: Setup local admin user with a fresh ubuntu host + hosts: nigel.local remote_user: nigel vars: admin: username: nigel tasks: - name: Copy the nigel admin key - ansible.builtin.authorized_key: + ansible.posix.authorized_key: user: "{{ admin.username }}" state: present key: "{{ lookup('file', '~/.ssh/nigel/admin.pub') }}" @@ -24,4 +25,4 @@ become: true ansible.builtin.service: name: ssh - state: restarted \ No newline at end of file + state: restarted diff --git a/ansible/nuc.yaml b/ansible/nuc.yaml index cd3acbc..da05402 100644 --- a/ansible/nuc.yaml +++ b/ansible/nuc.yaml @@ -1,5 +1,6 @@ --- -- hosts: nigel.local +- name: Setup bare metal requirements for nomad + hosts: nigel.local remote_user: nigel tasks: - name: Setup basic role on nigel diff --git a/ansible/proxy.yaml b/ansible/proxy.yaml index e729306..61c33f1 100644 --- a/ansible/proxy.yaml +++ b/ansible/proxy.yaml @@ -1,7 +1,8 @@ --- -- hosts: nigel.local +- name: Setup host as a reverse proxy + hosts: nigel.local remote_user: nigel tasks: - name: Apply reverse proxy role ansible.builtin.include_role: - name: proxy \ No newline at end of file + name: proxy diff --git a/ansible/roles/base/tasks/main.yaml b/ansible/roles/base/tasks/main.yaml index 4f55369..2db0149 100644 --- a/ansible/roles/base/tasks/main.yaml +++ b/ansible/roles/base/tasks/main.yaml @@ -22,4 +22,4 @@ apply: become: true tags: - - nomad \ No newline at end of file + - nomad diff --git a/ansible/roles/base/tasks/nomad.yaml b/ansible/roles/base/tasks/nomad.yaml index 1eda1f1..7d5e446 100644 --- a/ansible/roles/base/tasks/nomad.yaml +++ b/ansible/roles/base/tasks/nomad.yaml @@ -10,25 +10,26 @@ keypath: /usr/share/keyrings/hashicorp-archive-keyring.gpg gpgpath: /tmp/hashicorp.gpg block: - - name: Download the hashicorp GPG Key - ansible.builtin.get_url: - url: https://apt.releases.hashicorp.com/gpg - dest: "{{ gpgpath }}" - - name: Dearmor the hashicorp gpg key - ansible.builtin.command: - cmd: "gpg --dearmor --yes -o {{ keypath }} {{ gpgpath }}" - register: gpg - changed_when: gpg.rc == 0 - - name: Add the hashicorp linux repo - vars: - keyfile: "{{ keypath }}" - ansible.builtin.template: - src: hashicorp.list - dest: /etc/apt/sources.list.d/hashicorp.list - mode: "0644" - - name: Update apt repo cache - ansible.builtin.apt: - update_cache: true + - name: Download the hashicorp GPG Key + ansible.builtin.get_url: + url: https://apt.releases.hashicorp.com/gpg + dest: "{{ gpgpath }}" + mode: "0755" + - name: Dearmor the hashicorp gpg key + ansible.builtin.command: + cmd: "gpg --dearmor --yes -o {{ keypath }} {{ gpgpath }}" + register: gpg + changed_when: gpg.rc == 0 + - name: Add the hashicorp linux repo + vars: + keyfile: "{{ keypath }}" + ansible.builtin.template: + src: hashicorp.list + dest: /etc/apt/sources.list.d/hashicorp.list + mode: "0644" + - name: Update apt repo cache + ansible.builtin.apt: + update_cache: true - name: Install consul ansible.builtin.apt: name: consul @@ -36,7 +37,7 @@ ansible.builtin.apt: pkg: nomad - name: Copy in the consul configuration - vars: + vars: ip: "{{ ansible_default_ipv4['address'] }}" ansible.builtin.template: src: consul.hcl @@ -51,4 +52,4 @@ ansible.builtin.systemd_service: name: consul state: stopped - enabled: true \ No newline at end of file + enabled: true diff --git a/ansible/roles/base/vars/main.yaml b/ansible/roles/base/vars/main.yaml index 43dce24..e69de29 100644 --- a/ansible/roles/base/vars/main.yaml +++ b/ansible/roles/base/vars/main.yaml @@ -1 +0,0 @@ -host_vol_root: /opt/volumes \ No newline at end of file diff --git a/ansible/roles/nomad/tasks/main.yaml b/ansible/roles/nomad/tasks/main.yaml index f33d50f..aa8b1e8 100644 --- a/ansible/roles/nomad/tasks/main.yaml +++ b/ansible/roles/nomad/tasks/main.yaml @@ -2,7 +2,9 @@ ansible.builtin.file: path: "{{ nomad.volumes.root }}" state: directory + mode: "0755" - name: Ensure registry volume is present ansible.builtin.file: path: "{{ nomad.volumes.registry }}" - state: directory \ No newline at end of file + state: directory + mode: "0755" diff --git a/ansible/roles/proxy/vars/main.yaml b/ansible/roles/proxy/vars/main.yaml index e7fcc07..e1b4baa 100644 --- a/ansible/roles/proxy/vars/main.yaml +++ b/ansible/roles/proxy/vars/main.yaml @@ -1,3 +1,3 @@ proxy_nginx_configs: - nomad.conf - - ncr.conf \ No newline at end of file + - ncr.conf diff --git a/infra/containers/docker-compose.yaml b/infra/containers/docker-compose.yaml deleted file mode 100644 index 6cbaaf7..0000000 --- a/infra/containers/docker-compose.yaml +++ /dev/null @@ -1,40 +0,0 @@ -networks: - gitea: - external: false - - -services: - gitea: - image: gitea/gitea:latest-rootless - container_name: gitea - environment: - - USER_UID=1000 - - USER_GID=1000 - restart: always - networks: - - gitea - volumes: - - /opt/containers/gitea:/data - - /etc/timezone:/etc/timezone:ro - - /etc/localtime:/etc/localtime:ro - ports: - - "3000:3000" - - "2222:22" - gitea-runner: - image: gitea/act_runner:nightly - container_name: gitea-runner - restart: always - networks: - - gitea - volumes: - - /opt/containers/gitea_runner/ - - /var/run/docker.sock:/var/run/docker.sock - environment: - - GITEA_INSTANCE_URL=https://git.shockrah.xyz - - GITEA_RUNNER_NAME=gitea-main - - GITEA_RUNNER_LABELS=gitea-main - - GITEA_RUNNER_REGISTRATION_TOKEN=${token} - - - - diff --git a/infra/containers/readme.md b/infra/containers/readme.md deleted file mode 100644 index c665a2f..0000000 --- a/infra/containers/readme.md +++ /dev/null @@ -1,29 +0,0 @@ -What is this -============ - -Here we contain scripts to build out all the containers that are run. -All of these images are based on images that are made from other projects - -docker-compose.yaml -=================== - -Services that are more/less "special" go here since most of the stuff that is -run on the main host are basically just static html websites - -Services & Containers -===================== - -| Service | Docker Image Used | -|------------|--------------------------| -| Gitea | gitea/gitea:latest | -| Act Runner | gitea/act_runner:nightly | - -Why the servics above? -====================== - -The Gitea related services are there so that I can host my own Git projects -away from "Git as a service" services. I have no issue with Github/Gitlab -but I just like being able to host my own stuff when possible :smiley: - - - diff --git a/infra/containers/sanity-nginx/Dockerfile b/infra/containers/sanity-nginx/Dockerfile deleted file mode 100644 index 4902b2b..0000000 --- a/infra/containers/sanity-nginx/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -# Because I just really needed ok? -FROM nginx:latest - -COPY default /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/infra/containers/sanity-nginx/default b/infra/containers/sanity-nginx/default deleted file mode 100644 index 166ad1f..0000000 --- a/infra/containers/sanity-nginx/default +++ /dev/null @@ -1,15 +0,0 @@ -server { - listen 8080; - listen [::]:8080; - server_name localhost; - location / { - root /usr/share/nginx/html; - index index.html index.htm; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } - -} \ No newline at end of file