Funktionierende Version GIT

This commit is contained in:
Marcus Gillitzer 2020-06-15 18:10:05 +02:00
parent f30a27dbae
commit 19462ed401

View File

@ -10,48 +10,44 @@
- name: check if {{ path_init }} exists - name: check if {{ path_init }} exists
become: yes become: yes
file: file:
path: {{ path_init }} path: "{{ path_init }}"
owner: {{ user_name }} owner: "{{ user_name }}"
group: {{ user_group }} group: "{{ user_group }}"
mode: '0755' mode: '0755'
state: directory 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 {{ user_name }}/.git exists - name: check if {{ path_init }}/.git exists
stat: stat:
path: {{ user_name }}/.git path: "{{ path_init }}/.git"
register: p register: p
changed_when: false
- debug: - debug:
msg: " Path exists and is a directory" msg: " Path exists not and is not a directory"
when: p.stat.isdir is defined and p.stat.isdir when: p.stat.exists == false
#- name: check if {{ path_init }}/.git exists - name: Initialisiere leeres Repo innerhalb von {{ path_init }}
#shell: ls -ld {{ path_init }}/.git become_user: gillitze
#register: result command: git init {{ path_init }}/
#ignore_errors: true when: p.stat.exists == false
#- debug:
#msg: "{{ result }}"
#- name: Initialisiere leeres Repo innerhalb von {{ path_init }}
#command: git init {{ path_init }}/
#when: result.stdout == ''
- name: commit changes to git - name: commit changes to git
become_user: gillitze
shell: | shell: |
git add . git add .
git -c user.name='{{ user_name }} Playbook' -c user.email='{{ user_name }}@playbook' commit -m "Initialisiere GIT" git -c user.name='{{ user_name }} Playbook' -c user.email='{{ user_name }}@playbook' commit -m "Initialisiere GIT"
exit 0 exit 0
args: args:
chdir: "{{ path_init }}" chdir: "{{ path_init }}"
when: p.stat.exists == false