diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-08 18:01:11 -0700 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-11 18:36:51 -0700 |
| commit | 33bfce81f82fa1caf7d061485d257d7838534f19 (patch) | |
| tree | 0d11c71b3d80cff954f1f777a0e524b156eb16c8 | |
| parent | Add public and private git repo dir setup (diff) | |
| download | site-configs-33bfce81f82fa1caf7d061485d257d7838534f19.zip | |
Resolve ansible-lint findings
Primarily, this is renaming variables to be prefixed with the role name.
| -rw-r--r-- | inventory/git.yml | 2 | ||||
| -rw-r--r-- | roles/acme_client/defaults/main.yml | 2 | ||||
| -rw-r--r-- | roles/acme_client/tasks/main.yml | 20 | ||||
| -rw-r--r-- | roles/acme_client/templates/acme-client.conf.j2 | 6 | ||||
| -rw-r--r-- | roles/acme_client/templates/httpd.d/acme.conf | 2 | ||||
| -rw-r--r-- | roles/obsd_cgit/defaults/main.yml | 6 | ||||
| -rw-r--r-- | roles/obsd_cgit/handlers/main.yml | 6 | ||||
| -rw-r--r-- | roles/obsd_cgit/tasks/main.yml | 6 | ||||
| -rw-r--r-- | roles/obsd_cgit/templates/cgitrc.j2 | 4 | ||||
| -rw-r--r-- | roles/obsd_cgit/templates/httpd.d/cgit.conf.j2 | 6 | ||||
| -rw-r--r-- | roles/obsd_git/defaults/main.yml | 6 | ||||
| -rw-r--r-- | roles/obsd_git/tasks/main.yml | 54 | ||||
| -rw-r--r-- | roles/obsd_git/templates/git-shell-commands/create | 4 | ||||
| -rw-r--r-- | roles/obsd_httpd/defaults/main.yml | 2 | ||||
| -rw-r--r-- | roles/obsd_httpd/tasks/main.yml | 6 | ||||
| -rw-r--r-- | roles/obsd_httpd/templates/httpd.conf.j2 | 2 |
16 files changed, 71 insertions, 63 deletions
diff --git a/inventory/git.yml b/inventory/git.yml index 5ae9041..7a5c789 100644 --- a/inventory/git.yml +++ b/inventory/git.yml @@ -7,4 +7,4 @@ all: ansible_user: admin ansible_python_interp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Oi6fdI+r67gpjRSs+PNvDle3gImfIkPnEQg4eWJ54iKjfH+yd8vBk25T/ahu3J9rGgxp18= eugene@laptop" # noqa: yaml[line-length] diff --git a/roles/acme_client/defaults/main.yml b/roles/acme_client/defaults/main.yml index d530d0e..07c2a4a 100644 --- a/roles/acme_client/defaults/main.yml +++ b/roles/acme_client/defaults/main.yml @@ -1 +1 @@ -acme_domain: "{{ acme_domain }}" +acme_client_domain: "{{ acme_domain }}" diff --git a/roles/acme_client/tasks/main.yml b/roles/acme_client/tasks/main.yml index 35974e0..531857f 100644 --- a/roles/acme_client/tasks/main.yml +++ b/roles/acme_client/tasks/main.yml @@ -1,11 +1,11 @@ - name: Deploy acme challenge vhost fragment ansible.builtin.template: src: httpd.d/acme.conf - dest: "{{ httpd_conf_d | default('/etc/httpd.d') }}/acme.conf" + dest: "{{ obsd_httpd_conf_d | default('/etc/httpd.d') }}/acme.conf" owner: root group: wheel mode: "0644" - register: acme_vhost_config + register: acme_client_vhost_config - name: Deploy acme-client.conf ansible.builtin.template: @@ -15,13 +15,19 @@ group: wheel mode: "0600" -- name: Restart httpd +- name: Start httpd ansible.builtin.service: name: httpd - state: restarted - when: acme_vhost_config is changed + state: started + when: acme_client_vhost_config is changed # noqa: no-handler + +- name: Reload httpd + ansible.builtin.service: + name: httpd + state: reloaded + when: acme_client_vhost_config is changed # noqa: no-handler - name: Generate certificate - ansible.builtin.command: acme-client {{ acme_domain }} + ansible.builtin.command: acme-client {{ acme_client_domain }} args: - creates: "/etc/ssl/{{ acme_domain }}.fullchain.pem" + creates: "/etc/ssl/{{ acme_client_domain }}.fullchain.pem" diff --git a/roles/acme_client/templates/acme-client.conf.j2 b/roles/acme_client/templates/acme-client.conf.j2 index a9bccfc..54036b9 100644 --- a/roles/acme_client/templates/acme-client.conf.j2 +++ b/roles/acme_client/templates/acme-client.conf.j2 @@ -8,8 +8,8 @@ authority letsencrypt-staging { account key "/etc/acme/letsencrypt-staging-privkey.pem" } -domain "{{ acme_domain }}" { - domain key "/etc/ssl/private/{{ acme_domain }}.key" - domain full chain certificate "/etc/ssl/{{ acme_domain }}.fullchain.pem" +domain "{{ acme_client_domain }}" { + domain key "/etc/ssl/private/{{ acme_client_domain }}.key" + domain full chain certificate "/etc/ssl/{{ acme_client_domain }}.fullchain.pem" sign with letsencrypt } diff --git a/roles/acme_client/templates/httpd.d/acme.conf b/roles/acme_client/templates/httpd.d/acme.conf index 558a8bd..905da28 100644 --- a/roles/acme_client/templates/httpd.d/acme.conf +++ b/roles/acme_client/templates/httpd.d/acme.conf @@ -1,4 +1,4 @@ -server "{{ acme_domain }}" { +server "{{ acme_client_domain }}" { listen on * port 80 location "/.well-known/acme-challenge/*" { root "/acme" diff --git a/roles/obsd_cgit/defaults/main.yml b/roles/obsd_cgit/defaults/main.yml index eb983fa..5a4855c 100644 --- a/roles/obsd_cgit/defaults/main.yml +++ b/roles/obsd_cgit/defaults/main.yml @@ -1,4 +1,4 @@ -cgit_domain: "{{ cgit_domain }}" +obsd_cgit_domain: "{{ cgit_domain }}" # Absolute path from /var/www chroot that httpd runs in -cgit_cache_dir: /cgit/cache -cgit_repos_dir: /git/public +obsd_cgit_cache_dir: /cgit/cache +obsd_cgit_repos_dir: /git/public diff --git a/roles/obsd_cgit/handlers/main.yml b/roles/obsd_cgit/handlers/main.yml index 3af955f..356bdcb 100644 --- a/roles/obsd_cgit/handlers/main.yml +++ b/roles/obsd_cgit/handlers/main.yml @@ -1,2 +1,4 @@ -- name: restart httpd - ansible.builtin.command: rcctl restart httpd +- name: Reload httpd + ansible.builtin.service: + name: httpd + state: reloaded diff --git a/roles/obsd_cgit/tasks/main.yml b/roles/obsd_cgit/tasks/main.yml index 6530b18..ec79515 100644 --- a/roles/obsd_cgit/tasks/main.yml +++ b/roles/obsd_cgit/tasks/main.yml @@ -6,15 +6,15 @@ - name: Deploy cgit vhost fragment ansible.builtin.template: src: httpd.d/cgit.conf.j2 - dest: "{{ httpd_conf_d | default('/etc/httpd.d') }}/cgit.conf" + dest: "{{ obsd_httpd_conf_d | default('/etc/httpd.d') }}/cgit.conf" owner: root group: wheel mode: "0644" - notify: restart httpd + notify: Reload httpd - name: Create cgit cache directory ansible.builtin.file: - path: "/var/www{{ cgit_cache_dir }}" + path: "/var/www{{ obsd_cgit_cache_dir }}" state: directory owner: www group: daemon diff --git a/roles/obsd_cgit/templates/cgitrc.j2 b/roles/obsd_cgit/templates/cgitrc.j2 index 22fbdab..ab2fcbd 100644 --- a/roles/obsd_cgit/templates/cgitrc.j2 +++ b/roles/obsd_cgit/templates/cgitrc.j2 @@ -26,6 +26,6 @@ css=/cgit.css logo=/cgit.png virtual-root=/ section-from-path=1 -scan-path={{ cgit_repos_dir }} -cache-root={{ cgit_cache_dir }} +scan-path={{ obsd_cgit_repos_dir }} +cache-root={{ obsd_cgit_cache_dir }} cache-size=1000 diff --git a/roles/obsd_cgit/templates/httpd.d/cgit.conf.j2 b/roles/obsd_cgit/templates/httpd.d/cgit.conf.j2 index 0b903e4..a10b880 100644 --- a/roles/obsd_cgit/templates/httpd.d/cgit.conf.j2 +++ b/roles/obsd_cgit/templates/httpd.d/cgit.conf.j2 @@ -1,8 +1,8 @@ -server "{{ cgit_domain }}" { +server "{{ obsd_cgit_domain }}" { listen on egress tls port 443 tls { - certificate "/etc/ssl/{{ cgit_domain }}.fullchain.pem" - key "/etc/ssl/private/{{ cgit_domain }}.key" + certificate "/etc/ssl/{{ obsd_cgit_domain }}.fullchain.pem" + key "/etc/ssl/private/{{ obsd_cgit_domain }}.key" } # Serve cgit static files (cgit.css, cgit.png) directly from disk diff --git a/roles/obsd_git/defaults/main.yml b/roles/obsd_git/defaults/main.yml index d0ca79a..172f810 100644 --- a/roles/obsd_git/defaults/main.yml +++ b/roles/obsd_git/defaults/main.yml @@ -1,4 +1,4 @@ -git_user: git -git_home: /var/www/git -git_packages: +obsd_git_user: git +obsd_git_home: /var/www/git +obsd_git_packages: - git diff --git a/roles/obsd_git/tasks/main.yml b/roles/obsd_git/tasks/main.yml index 4d467d0..4d200f0 100644 --- a/roles/obsd_git/tasks/main.yml +++ b/roles/obsd_git/tasks/main.yml @@ -1,76 +1,76 @@ - name: Install git community.general.openbsd_pkg: - name: "{{ git_packages }}" + name: "{{ obsd_git_packages }}" state: present - name: Create git user ansible.builtin.user: - name: "{{ git_user }}" - home: "{{ git_home }}" + name: "{{ obsd_git_user }}" + home: "{{ obsd_git_home }}" create_home: false shell: /usr/local/bin/git-shell system: true - name: Create git home directory ansible.builtin.file: - path: "{{ git_home }}" + path: "{{ obsd_git_home }}" state: directory - owner: "{{ git_user }}" - group: "{{ git_user }}" + owner: "{{ obsd_git_user }}" + group: "{{ obsd_git_user }}" mode: "0755" - name: Create public git repository directory ansible.builtin.file: - path: "{{ git_home }}/public" + path: "{{ obsd_git_home }}/public" state: directory - owner: "{{ git_user }}" - group: "{{ git_user }}" + owner: "{{ obsd_git_user }}" + group: "{{ obsd_git_user }}" mode: "0755" - name: Create private git repository directory ansible.builtin.file: - path: "{{ git_home }}/private" + path: "{{ obsd_git_home }}/private" state: directory - owner: "{{ git_user }}" - group: "{{ git_user }}" + owner: "{{ obsd_git_user }}" + group: "{{ obsd_git_user }}" mode: "0700" - name: Silence message of the day for git user ansible.builtin.file: - path: "{{ git_home }}/.hushlogin" + path: "{{ obsd_git_home }}/.hushlogin" state: touch - owner: "{{ git_user }}" - group: "{{ git_user }}" + owner: "{{ obsd_git_user }}" + group: "{{ obsd_git_user }}" mode: "0644" - name: Create .ssh directory ansible.builtin.file: - path: "{{ git_home }}/.ssh" + path: "{{ obsd_git_home }}/.ssh" state: directory - owner: "{{ git_user }}" - group: "{{ git_user }}" + owner: "{{ obsd_git_user }}" + group: "{{ obsd_git_user }}" mode: "0700" - name: Deploy authorized_keys ansible.builtin.copy: content: "{{ git_authorized_keys | join('\n') }}\n" - dest: "{{ git_home }}/.ssh/authorized_keys" - owner: "{{ git_user }}" - group: "{{ git_user }}" + dest: "{{ obsd_git_home }}/.ssh/authorized_keys" + owner: "{{ obsd_git_user }}" + group: "{{ obsd_git_user }}" mode: "0600" - name: Create git-shell-commands directory ansible.builtin.file: - path: "{{ git_home }}/git-shell-commands" + path: "{{ obsd_git_home }}/git-shell-commands" state: directory - owner: "{{ git_user }}" - group: "{{ git_user }}" + owner: "{{ obsd_git_user }}" + group: "{{ obsd_git_user }}" mode: "0755" - name: Deploy git-shell create-repo helper script ansible.builtin.template: src: git-shell-commands/create - dest: "{{ git_home }}/git-shell-commands/create" - owner: "{{ git_user }}" - group: "{{ git_user }}" + dest: "{{ obsd_git_home }}/git-shell-commands/create" + owner: "{{ obsd_git_user }}" + group: "{{ obsd_git_user }}" mode: "0755" diff --git a/roles/obsd_git/templates/git-shell-commands/create b/roles/obsd_git/templates/git-shell-commands/create index 9ac25a5..53899eb 100644 --- a/roles/obsd_git/templates/git-shell-commands/create +++ b/roles/obsd_git/templates/git-shell-commands/create @@ -11,13 +11,13 @@ main() { repo_name=$(basename "$REPO" .git) if [ -n "$PROJ" ]; then - proj_dir="{{ git_home }}/$VISIBILITY/$PROJ" + proj_dir="{{ obsd_git_home }}/$VISIBILITY/$PROJ" if [ ! -d "$proj_dir" ]; then mkdir "$proj_dir" fi repo_path="$proj_dir/$repo_name.git" else - repo_path="{{ git_home }}/$VISIBILITY/$repo_name.git" + repo_path="{{ obsd_git_home }}/$VISIBILITY/$repo_name.git" fi if [ ! -d "$repo_path" ]; then diff --git a/roles/obsd_httpd/defaults/main.yml b/roles/obsd_httpd/defaults/main.yml index 48406cb..f7b6b57 100644 --- a/roles/obsd_httpd/defaults/main.yml +++ b/roles/obsd_httpd/defaults/main.yml @@ -1 +1 @@ -httpd_conf_d: /etc/httpd.d +obsd_httpd_conf_d: /etc/httpd.d diff --git a/roles/obsd_httpd/tasks/main.yml b/roles/obsd_httpd/tasks/main.yml index 6e21ab8..2dd1b30 100644 --- a/roles/obsd_httpd/tasks/main.yml +++ b/roles/obsd_httpd/tasks/main.yml @@ -1,6 +1,6 @@ - name: Create httpd conf include directory ansible.builtin.file: - path: "{{ httpd_conf_d }}" + path: "{{ obsd_httpd_conf_d }}" state: directory owner: root group: wheel @@ -13,12 +13,12 @@ owner: root group: wheel mode: "0600" - notify: restart httpd + notify: Reload httpd - name: Ensure all registered httpd fragment files exist ansible.builtin.copy: content: "" - dest: "{{ httpd_conf_d }}/{{ item }}" + dest: "{{ obsd_httpd_conf_d }}/{{ item }}" force: false # If it already exists, don't overwrite it. owner: root group: wheel diff --git a/roles/obsd_httpd/templates/httpd.conf.j2 b/roles/obsd_httpd/templates/httpd.conf.j2 index beec99c..2825853 100644 --- a/roles/obsd_httpd/templates/httpd.conf.j2 +++ b/roles/obsd_httpd/templates/httpd.conf.j2 @@ -1,5 +1,5 @@ types { include "/usr/share/misc/mime.types" } {% for fragment in httpd_fragments %} -include "{{ httpd_conf_d }}/{{ fragment }}" +include "{{ obsd_httpd_conf_d }}/{{ fragment }}" {% endfor %} |