--- - 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: /opt/rola/.gitignore owner: jetty group: dba mode: '0644' - name: check if /opt/rola/.git exists shell: ls -ld /opt/rola/.git register: result ignore_errors: true - debug: msg: "{{ result }}" - name: Initialisiere leeres Repo innerhalb von /opt/rola command: git init /opt/rola/ when: result.stdout == '' - name: commit changes to git shell: | git add . git -c user.name='Ansible Playbook' -c user.email='ansible@playbook' commit -m "Initialisiere_Basis_AMS" exit 0 args: chdir: "/opt/rola"