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 # defaults file for default_role
path_init: "/opt/rola" path_init: "/opt/rola"
user_name: "jetty" user_name: "jetty"
user_group: "dba" 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 name: git.x86_64
state: latest state: latest
disable_gpg_check: true 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 - name: Copy file .gitignore with owner and permissions
copy: copy:
src: ./files/gitignore src: ./files/.gitignore
dest: "{{ path_init }}/.gitignore" dest: {{ path_init }}/.gitignore
owner: "{{ user_name }}" owner: {{ user_name }}
group: "{{ user_group }}" group: {{ user_group }}
mode: '0644' mode: '0644'
- name: check if {{ path_init }}/.git exists - name: check if {{ user_name }}/.git exists
shell: ls -ld {{ path_init }}/.git stat:
register: result path: {{ user_name }}/.git
ignore_errors: true register: p
- debug: - 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 }} #- name: Initialisiere leeres Repo innerhalb von {{ path_init }}
command: git init {{ path_init }}/ #command: git init {{ path_init }}/
when: result.stdout == '' #when: result.stdout == ''
- name: commit changes to git - name: commit changes to git
shell: | shell: |