2020-05-19 11:11:29 +02:00

57 lines
980 B
YAML

---
- name: Install git via yum in latest version
become: yes
become_user: root
yum:
name: git.x86_64
state: latest
disable_gpg_check: true
- name: Copy file .gitignore with owner and permissions
copy:
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
- debug:
msg: "{{ result }}"
- name: Initialisiere leeres Repo innerhalb von {{ path_init }}
command: git init {{ path_init }}/
when: result.stdout == ''
- name: commit changes to git
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 }}"