diff options
| -rw-r--r-- | infrastructure/roles/git/README.md | 33 | ||||
| -rw-r--r-- | infrastructure/roles/git/tasks/main.yaml | 29 |
2 files changed, 30 insertions, 32 deletions
diff --git a/infrastructure/roles/git/README.md b/infrastructure/roles/git/README.md index 37f6ceb..cf1135b 100644 --- a/infrastructure/roles/git/README.md +++ b/infrastructure/roles/git/README.md @@ -2,34 +2,5 @@ ## Create a repository -On the server: - -``` -git init --bare $REPOSITORY_PATH -``` - -## Push an existing repository - -``` -git remote add $REMOTE $SERVER_HOSTNAME:$REPOSITORY_PATH -git push $REMOTE main -``` - -## Exposing via gitweb - -``` -sudo ln -s $REPOSITORY_PATH /var/lib/git/$NAME.git -``` - -## Exposing via https - -``` -mv $REPOSITORY_PATH/hooks/post-update.sample $REPOSITORY_PATH/hooks/post-update -ln -s $REPOSITORY_PATH ~/public_html/$REPO.git -``` - -Ensure that you push once to the repo, or run `git update-server-info` in the repository. - -## Using non-bare repositories - -Alternatively, use non-bare repositories and symlink the `.git` directory to `/var/lib/git` or `~/public_html`. +You own `/srv/repos/$USER`. +You can put repositories there to expose them at `https://host/cgit/`. diff --git a/infrastructure/roles/git/tasks/main.yaml b/infrastructure/roles/git/tasks/main.yaml index ba39e05..8c8f2e5 100644 --- a/infrastructure/roles/git/tasks/main.yaml +++ b/infrastructure/roles/git/tasks/main.yaml @@ -2,9 +2,36 @@ ansible.builtin.package: name: - git - - gitweb + - cgit - name: enable cgid ansible.builtin.command: cmd: a2enmod cgid creates: /etc/apache2/mods-enabled/cgid.load notify: restart web +- name: configure cgit + ansible.builtin.copy: + content: | + # + # cgit config + # see cgitrc(5) for details + + css=/cgit-css/cgit.css + logo=/cgit-css/cgit.png + + scan-path=/srv/repos + dest: /etc/cgitrc +- name: create repository directory + ansible.builtin.file: + path: /srv/repos/ + state: directory + owner: nobody + group: www-data +- name: create user repository directories + ansible.builtin.file: + path: "/srv/repos/{{ item.name }}" + state: directory + owner: "{{ item.name }}" + group: "{{ item.name }}" + loop: "{{ users }}" + loop_control: + label: "{{ item.name }}" |
