From 3147612e821c234c8df7a82760b66a6c373f799a Mon Sep 17 00:00:00 2001 From: binary Date: Wed, 3 Mar 2021 14:56:44 +0100 Subject: Add nfs to git with correct permissions --- roles/cgit/tasks/main.yml | 44 ++++++++------------------------------------ roles/git/tasks/main.yml | 2 +- 2 files changed, 9 insertions(+), 37 deletions(-) diff --git a/roles/cgit/tasks/main.yml b/roles/cgit/tasks/main.yml index f84e7e8..286ffab 100644 --- a/roles/cgit/tasks/main.yml +++ b/roles/cgit/tasks/main.yml @@ -43,49 +43,21 @@ group: "{{ group_root }}" mode: 0755 -- name: unmount potential existing filesystem in target directory - shell: "umount /var/www/{{ cgit_git_dir_chroot }}" - register: result - failed_when: result.rc != 0 and "not currently mounted" not in result.stderr - - name: ensure cgit web directory exists file: path: /var/www/{{ cgit_git_dir_chroot }} owner: www group: daemon - mode: 0644 + mode: 0655 state: directory -- name: enable shared git directory in /etc/exports - lineinfile: - path: /etc/exports - regexp: "^{{ cgit_git_dir }}" - line: "{{ cgit_git_dir }} -mapall=root -alldirs -network=127.0.0.1 -mask=255.255.255.255 -ro" - owner: "{{ user_root }}" - group: "{{ group_root }}" - mode: 0644 - create: true - -- name: enable shared git directory in /etc/exports - lineinfile: - path: /etc/fstab - regexp: "^localhost:{{ cgit_git_dir }}" - line: "localhost:{{ cgit_git_dir }} /var/www/{{ cgit_git_dir_chroot }} nfs rw,nodev,nosuid,soft,intr 0 0" - -- name: start and enable share directory - service: - name: "{{ item }}" - state: restarted - enabled: true - loop: - - "portmap" - - "nfsd" - -- name: start and enable mountd - shell: | - rcctl enable mountd - pkill -9 mountd - rcctl start mountd +- name: include nfsclient for remote dir + include_role: + name: nfsclient + vars: + nfsclient_dir: "/var/www/{{ cgit_git_dir_chroot }}" + nfsclient_server_dir: "{{ global.nfs_server_dir }}/{{ ansible_host }}/git" + #nfsclient_server: "{{ global.nfs_server }}" - name: ensure nfs volume is mounted shell: mount -A diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml index 70b887d..5600e2d 100644 --- a/roles/git/tasks/main.yml +++ b/roles/git/tasks/main.yml @@ -29,7 +29,7 @@ owner: "{{ git_user }}" group: "{{ git_group }}" state: directory - mode: 0750 + mode: 0755 - name: link git user home directory with git root repository file: -- cgit v1.2.3