Fehlerkorrektur an Git-Role

This commit is contained in:
Marcus Gillitzer 2020-06-12 08:54:44 +02:00
parent b7435bee92
commit f30a27dbae
3 changed files with 45 additions and 15 deletions

View File

@ -1,5 +1,5 @@
---
# defaults file for default_role
path_init: "/opt/rola"
user_name: "jetty"
user_group: "dba"
path_init: "/opt/rola"
user_name: "jetty"
user_group: "dba"

12
roles/git/files/.gitignore vendored Executable file
View File

@ -0,0 +1,12 @@
# Ignore everything
*
# But not these files...
!.gitignore
!*.xml
!*.conf
# etc...
# ...even if they are in subdirectories
!*/

View File

@ -6,26 +6,44 @@
name: git.x86_64
state: latest
disable_gpg_check: true
- name: check if {{ path_init }} exists
become: yes
file:
path: {{ path_init }}
owner: {{ user_name }}
group: {{ user_group }}
mode: '0755'
state: directory
- name: Copy file .gitignore with owner and permissions
copy:
src: ./files/gitignore
dest: "{{ path_init }}/.gitignore"
owner: "{{ user_name }}"
group: "{{ user_group }}"
src: ./files/.gitignore
dest: {{ path_init }}/.gitignore
owner: {{ user_name }}
group: {{ user_group }}
mode: '0644'
- name: check if {{ path_init }}/.git exists
shell: ls -ld {{ path_init }}/.git
register: result
ignore_errors: true
- name: check if {{ user_name }}/.git exists
stat:
path: {{ user_name }}/.git
register: p
- debug:
msg: "{{ result }}"
msg: " Path exists and is a directory"
when: p.stat.isdir is defined and p.stat.isdir
#- name: check if {{ path_init }}/.git exists
#shell: ls -ld {{ path_init }}/.git
#register: result
#ignore_errors: true
#- debug:
#msg: "{{ result }}"
- name: Initialisiere leeres Repo innerhalb von {{ path_init }}
command: git init {{ path_init }}/
when: result.stdout == ''
#- name: Initialisiere leeres Repo innerhalb von {{ path_init }}
#command: git init {{ path_init }}/
#when: result.stdout == ''
- name: commit changes to git
shell: |