Hands-on Lab·Ansible
Ansible Git Repository Cloning
EX294 expects you to clone a repository and work in it. The clone itself is one command; the part that costs people time is that cloning an **empty** repository takes its branch name from your machine, not from the server - so a repo created with `main` hands you `master`, and the first push fails.
Templates, Files and Vault Guide 22 of 45 Beginner
- OSUbuntu 26.04 LTS
- ansible-core2.20.1
- Python3.14.4
- TimeAbout 14 min
- Reviewed28 August 2026
Written against the versions above. Git 2.53 still defaults `init.defaultBranch` to `master` and prints a hint saying it changes in Git 3.0. Until then the mismatch below is the default behaviour on a fresh machine, not a misconfiguration.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| ANS-CTL01 | 192.168.0.36 | Ubuntu 26.04 LTS | Ansible Control Node | 2 Core | 3 GB | 50 GB |
| ANS-B01 | 192.168.0.38 | Ubuntu 26.04 LTS | Managed Node (group: db) | 2 Core | 3 GB | 50 GB |
Before you start
- A control node configured as shown in the first step.
- SSH from the control node to the machine holding the repository.
-
The configuration this guide assumes
-
A repository to clone from
-
Clone it
-
Identity, then a first commit
-
Fix the branch, then push
-
Prove it round-trips
-
Pull someone else's change