aboutsummaryrefslogtreecommitdiffstats
path: root/roles/cgit/tasks
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2023-01-22 19:51:36 +0100
committerRomain Gonçalves <me@rgoncalves.se>2023-04-02 11:45:09 +0200
commit0c70ea19a91fa28cc5f97364ce1276ad5ae6f898 (patch)
tree34fc0e5817a32d8ef50341c464562385428a0d5a /roles/cgit/tasks
parent1cdb3d7f5aa68be5d90cfbbbc69918ac7823a8ae (diff)
downloadrules-0c70ea19a91fa28cc5f97364ce1276ad5ae6f898.tar.gz
feat(roles/cgit): add argument specs
Diffstat (limited to 'roles/cgit/tasks')
-rw-r--r--roles/cgit/tasks/dependencies.yml35
-rw-r--r--roles/cgit/tasks/main.yml62
2 files changed, 42 insertions, 55 deletions
diff --git a/roles/cgit/tasks/dependencies.yml b/roles/cgit/tasks/dependencies.yml
deleted file mode 100644
index a0d4d65..0000000
--- a/roles/cgit/tasks/dependencies.yml
+++ /dev/null
@@ -1,35 +0,0 @@
----
-
-- name: retrieve dependencies for lowdown # noqa: no-changed-when
- ansible.builtin.shell: |
- set -o pipefail
- ldd /usr/local/bin/lowdown | tr -s " " | grep "0 1 0" | cut -d " " -f 7
- register: result
-
-- name: create dependencies directories in chroot
- ansible.builtin.file:
- path: "{{ cgit_chroot_dir }}{{ item | dirname }}"
- owner: 0
- group: 0
- mode: "0755"
- state: directory
- loop: "{{ result.stdout_lines }}"
-
-- name: copy dependencies for lowdown
- ansible.builtin.copy:
- src: "{{ item }}"
- dest: "{{ cgit_chroot_dir }}/{{ item }}"
- mode: preserve
- remote_src: true
- loop: "{{ result.stdout_lines }}"
-
-- name: copy utilities in httpd chroot
- ansible.builtin.copy:
- src: "{{ item }}"
- dest: "{{ cgit_chroot_dir }}/bin"
- mode: preserve
- remote_src: true
- loop:
- - /bin/sh
- - /bin/cat
- - /usr/local/bin/lowdown
diff --git a/roles/cgit/tasks/main.yml b/roles/cgit/tasks/main.yml
index 64452f8..ce9ecbe 100644
--- a/roles/cgit/tasks/main.yml
+++ b/roles/cgit/tasks/main.yml
@@ -9,29 +9,58 @@
- name: create cgit cache directory
ansible.builtin.file:
- path: "{{ cgit_chroot_dir }}/cache/cgit"
- owner: www
- group: www
+ path: "{{ cgit_chroot_dir }}/{{ cgit_cache_dir }}"
+ owner: "{{ cgit_user }}"
+ group: "{{ cgit_group }}"
mode: "0750"
state: directory
- name: generate cgit configuration files
ansible.builtin.template:
- src: "{{ item.template }}"
- dest: "{{ item.file }}"
+ src: "{{ item.src }}"
+ dest: "{{ item.dest }}"
owner: 0
group: 0
mode: "0644"
loop:
- - template: cgitrc.j2
- file: "{{ cgit_chroot_dir }}/conf/cgitrc"
- - template: footer.html.j2
- file: "{{ cgit_chroot_dir }}/conf/footer.html"
- - template: httpd.conf.j2
- file: /etc/httpd.d/cgit.conf
+ - src: cgitrc.j2
+ dest: "{{ cgit_chroot_dir }}/conf/cgitrc"
+ - src: footer.html.j2
+ dest: "{{ cgit_chroot_dir }}/conf/footer.html"
+ - src: httpd.conf.j2
+ dest: /etc/httpd.d/cgit.conf
-- name: include dependencies for lowdown
- ansible.builtin.include_tasks: dependencies.yml
+- name: retrieve dependencies for lowdown
+ ansible.builtin.shell: |
+ set -o pipefail
+ ldd $(command -v lowdown) | tr -s " " | grep "0 1 0" | cut -d " " -f 7
+ register: cgit_result_lowdown_dependencies
+ changed_when: false
+
+- name: create dependencies directories in chroot
+ ansible.builtin.file:
+ path: "{{ cgit_chroot_dir }}{{ item | dirname }}"
+ owner: 0
+ group: 0
+ mode: "0755"
+ state: directory
+ loop: "{{ cgit_result_lowdown_dependencies.stdout_lines }}"
+
+- name: copy dependencies for lowdown
+ ansible.builtin.copy:
+ src: "{{ item }}"
+ dest: "{{ cgit_chroot_dir }}/{{ item }}"
+ mode: preserve
+ remote_src: true
+ loop: "{{ cgit_result_lowdown_dependencies.stdout_lines }}"
+
+- name: copy utilities in httpd chroot
+ ansible.builtin.copy:
+ src: "{{ item }}"
+ dest: "{{ cgit_chroot_dir }}/bin"
+ mode: preserve
+ remote_src: true
+ loop: "{{ cgit_chroot_required_files }}"
- name: copy about-filter generator
ansible.builtin.copy:
@@ -46,10 +75,3 @@
name: slowcgi
state: restarted
enabled: true
-
-- name: httpd password information
- ansible.builtin.debug:
- msg: |
- Please provide a password using htpasswd,
- in "{{ cgit_chroot_dir }}/htpasswd/cgit"
- when: cgit_authenticate
remember that computers suck.