=====Lokales Git Repo für ein Ansible Tower Projekt verwenden=====
Aufgaben:
In Ansible Tower soll ein lokales Git Repository im Projekt verwendet werden
==== Vorbereitung auf dem Ansible Tower Server ====
Git installieren
dnf git
User für das Repository anlegen
useradd ansible
passwd ansible
su - ansible
# Zugriff auf sich selbst konfigurieren!
ssh ansible01.pipperr.local cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
#Auf die richtigen Rechte achten!
chmod 600 ~/.ssh/authorized_keys
----
==== Git Repository unter dem User ansible anlegen ====
#root
mkdir -p /srv/ansible_code
chown -R ansible:ansible /srv/ansible_code
#Ansible
su - ansible
cd /srv/ansible_code
#
#mkdir
mkdir 01_ansible_user_management
#cd
cd 01_ansible_user_management
git init --shared
#Add your files
git add -A
git config --global user.email "gunther@pipperr.local"
git config --global user.name "Gunther Pippèrr"
git commit -m "inital commit"
Testen ob das Repository auch lesbar ist
su - awx
cd /tmp
/usr/bin/git clone --origin origin file://ansible@/srv/ansible/01_ansible_user_management
Cloning into '01_ansible_user_management'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
rm -rf /tmp/01_ansible_user_management
----
==== In Ansible Tower verwenden ====
=== Credentials für diesen User hinterlegen ===
* NAME: Local Git
* ORGANIZATION: Default
* CREDENTIAL TYPE: Source Control
* USERNAME: ansible
* SSH Key hinterlegen , Als user Ansible:
cat ~/.ssh/id_rsa
* Key unter (mit den “BEGIN” und “END” ) in das Feld "SSH PRIVATE KEY" einfügen
=== Projekt anlegen ===
* NAME: Oracle Maintainance
* ORGANIZATION: Default
* SCM TYPE: Git
* SCM URL: **ansible@localhost:/srv/ansible_code/01_ansible_user_management**
* **username@hostname:**
* SCM CREDENTIAL: das Git Credentials auswählen
* SCM UPDATE OPTIONS: Alle Optionen anwählen
{{ :linux:ansible_create_projekt_with_local_git.jpg | Ansible Projekt mit lokalen Git anlegen}}
----
==== Quellen ====
Web:
* https://goetzrieger.github.io/ansible-collections/4-using-collections-from-tower/