Funktionierende Version GIT
This commit is contained in:
parent
f30a27dbae
commit
19462ed401
@ -10,48 +10,44 @@
|
||||
- name: check if {{ path_init }} exists
|
||||
become: yes
|
||||
file:
|
||||
path: {{ path_init }}
|
||||
owner: {{ user_name }}
|
||||
group: {{ user_group }}
|
||||
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 {{ user_name }}/.git exists
|
||||
- name: check if {{ path_init }}/.git exists
|
||||
stat:
|
||||
path: {{ user_name }}/.git
|
||||
path: "{{ path_init }}/.git"
|
||||
register: p
|
||||
changed_when: false
|
||||
|
||||
- debug:
|
||||
msg: " Path exists and is a directory"
|
||||
when: p.stat.isdir is defined and p.stat.isdir
|
||||
msg: " Path exists not and is not a directory"
|
||||
when: p.stat.exists == false
|
||||
|
||||
#- 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 }}
|
||||
become_user: gillitze
|
||||
command: git init {{ path_init }}/
|
||||
when: p.stat.exists == false
|
||||
|
||||
- name: commit changes to git
|
||||
become_user: gillitze
|
||||
shell: |
|
||||
git add .
|
||||
git -c user.name='{{ user_name }} Playbook' -c user.email='{{ user_name }}@playbook' commit -m "Initialisiere GIT"
|
||||
exit 0
|
||||
args:
|
||||
chdir: "{{ path_init }}"
|
||||
chdir: "{{ path_init }}"
|
||||
when: p.stat.exists == false
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user