diff options
Diffstat (limited to 'roles/git')
-rw-r--r-- | roles/git/defaults/main.yml | 1 | ||||
-rw-r--r-- | roles/git/meta/main.yml | 41 | ||||
-rw-r--r-- | roles/git/tasks/main.yml | 11 | ||||
-rw-r--r-- | roles/git/templates/gitconfig.j2 | 2 |
4 files changed, 45 insertions, 10 deletions
diff --git a/roles/git/defaults/main.yml b/roles/git/defaults/main.yml index 436c46b..43597db 100644 --- a/roles/git/defaults/main.yml +++ b/roles/git/defaults/main.yml @@ -3,7 +3,6 @@ git_user: git git_group: git git_dir: /data/git - git_shell: /bin/sh git_default_branch: trunk git_allow_ssh_login: true diff --git a/roles/git/meta/main.yml b/roles/git/meta/main.yml new file mode 100644 index 0000000..1117027 --- /dev/null +++ b/roles/git/meta/main.yml @@ -0,0 +1,41 @@ +--- + +dependencies: + - role: sshd_keys + sshd_keys_users: + - "{{ git_user }}" + +argument_specs: + main: + short_description: git main entrypoint. + options: + + git_user: + type: str + required: true + description: Git user + + git_group: + type: str + required: true + description: Git group + + git_dir: + type: path + required: true + description: Git directory + + git_shell: + type: path + required: true + description: Shell of the git user + + git_default_branch: + type: str + required: true + description: Default branch when creating a git repository + + git_allow_ssh_login: + type: bool + required: true + description: Allow user to login with ssh diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml index 1f9d3d1..467378d 100644 --- a/roles/git/tasks/main.yml +++ b/roles/git/tasks/main.yml @@ -16,18 +16,15 @@ group: "{{ git_group }}" shell: "{{ git_shell }}" home: "{{ git_dir }}" - create_home: false + create_home: true - name: create git directories ansible.builtin.file: - path: "{{ item }}" + path: "{{ git_dir }}/git-shell-commands" owner: "{{ git_user }}" group: "{{ git_group }}" state: directory mode: "0755" - loop: - - "{{ git_dir }}" - - "{{ git_dir }}/git-shell-commands" - name: generate git-shell no-login prompt ansible.builtin.template: @@ -45,7 +42,3 @@ owner: "{{ git_user }}" group: "{{ git_group }}" mode: "0644" - -- name: include ssh key synchronization - ansible.builtin.include_role: - name: sshd_keys diff --git a/roles/git/templates/gitconfig.j2 b/roles/git/templates/gitconfig.j2 index b9923a2..3ffc6a9 100644 --- a/roles/git/templates/gitconfig.j2 +++ b/roles/git/templates/gitconfig.j2 @@ -1,2 +1,4 @@ +# managed by Ansible + [init] defaultBranch = {{ git_default_branch }} |