aboutsummaryrefslogblamecommitdiffstats
path: root/roles/cgit/tasks/main.yml
blob: 55dd72ddcb4cac6ad9f236892496e6c7c75c5653 (plain) (tree)
1
2
3
4
5
6
7
8
9

   
                             
                          
                                

                  
                                    
                       


                              
                
                    


                                    
 
                                         
                           

                           

            
                
       
                    
                                                
                         
                                     
                        
                                                          
 



                                                                          
                                             



                                                 
                                                      



                    
                                                              



                                     
                                             

                    
                                                              



                                      
                                      

                    
                                           
 
                       
                       

                                                 

            
                










                                                         

                                        
                          


                    
---

- name: install cgit packages
  ansible.builtin.package:
    name: "{{ cgit__packages }}"
    state: present

- name: create cgit data directories
  ansible.builtin.file:
    path: "{{ item }}"
    owner: "{{ cgit__user }}"
    group: "{{ cgit__group }}"
    mode: "0775"
    state: directory
  loop:
    - "{{ cgit__cache_dir }}"
    - "{{ cgit__repositories_dir }}"

- name: generate cgit configuration files
  ansible.builtin.template:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    owner: 0
    group: 0
    mode: "0644"
  loop:
    - src: cgitrc.j2
      dest: "{{ cgit__chroot_dir }}/conf/cgitrc"
    - src: footer.html.j2
      dest: "{{ cgit__footer_file }}"
    - src: httpd.conf.j2
      dest: "{{ httpd_pre__configuration_dir }}/cgit.conf"

- 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 generators
  ansible.builtin.copy:
    src: "{{ item }}"
    dest: "{{ cgit__chroot_dir }}/bin/{{ item }}"
    owner: 0
    group: 0
    mode: "0755"
  loop:
    - about-filter.sh
    - agefile-generator.sh

- name: enable agefile generator
  ansible.builtin.cron:
    name: cgit agefile-generator
    minute: "*/30"
    job: "{{ cgit__chroot_dir }}/bin/agefile-generator.sh
      {{ cgit__repositories_dir }}"
    user: "{{ cgit__user }}"

- name: start and enable slowcgi service
  ansible.builtin.service:
    name: slowcgi
    state: restarted
    enabled: true
remember that computers suck.