File size: 743 Bytes
53b59a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---
- name: Git Repository Setup
  hosts: all
  become: yes
  vars:
    repo_url: 'https://github.com/jake-molnia/CS_553'
    repo_dest: '/opt/CS_553'
  tasks:
    - name: Check if repository exists
      stat:
        path: "{{ repo_dest }}"
      register: repo_check

    - name: Remove existing repository if it exists
      file:
        path: "{{ repo_dest }}"
        state: absent
      when: repo_check.stat.exists

    - name: Clone the Git repository
      git:
        repo: "{{ repo_url }}"
        dest: "{{ repo_dest }}"
        version: main

    - name: Set permissions for the cloned repository
      file:
        path: "{{ repo_dest }}"
        owner: ubuntu
        group: ubuntu
        mode: '0755'
        recurse: yes