<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ansible Training – 1. Setting up Ansible</title><link>/docs/01/</link><description>Recent content in 1. Setting up Ansible on Ansible Training</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="/docs/01/index.xml" rel="self" type="application/rss+xml"/><item><title>Docs: 1.1 Git Repository</title><link>/docs/01/01/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/01/01/</guid><description>
&lt;p>In this lab, we set up our own git repository with &lt;a href="https://about.gitea.com/">Gitea&lt;/a> for later use.
Basic knowledge of &lt;a href="https://git-scm.com">git&lt;/a> is supposed.
If you are not familiar with git, you can learn everything about it here:
&lt;a href="https://git-scm.com/book/en/v2">https://git-scm.com/book/en/v2&lt;/a>&lt;/p>
&lt;p>There is also extensive documentation of Gitea available at &lt;a href="https://docs.gitea.com/">https://docs.gitea.com/&lt;/a>.&lt;/p>
&lt;h3 id="task-1">Task 1&lt;/h3>
&lt;p>Login to gitea at &lt;code>https://&amp;lt;yourname&amp;gt;-controller.workshop.puzzle.ch:4000&lt;/code> and create your own repository &lt;code>techlab&lt;/code>.&lt;/p>
&lt;details >
&lt;summary>Solution Task 1&lt;/summary>
&lt;ul>
&lt;li>Navigate your webbrowser to &lt;code>https://&amp;lt;yourname&amp;gt;-controller.workshop.puzzle.ch:4000&lt;/code> . Be sure to use port 4000.&lt;/li>
&lt;li>In the upper right corner click on &lt;code>Sign In&lt;/code>.&lt;/li>
&lt;li>Enter your username and password provided by the teacher. Then click the green button &lt;code>Sign In&lt;/code>.&lt;/li>
&lt;li>Click on the &lt;code>+&lt;/code> sign to the right of &lt;code>Repostories&lt;/code>.&lt;/li>
&lt;li>Enter &lt;code>techlab&lt;/code> as repository name and click &lt;code>create repository&lt;/code>.&lt;/li>
&lt;/ul>
&lt;/details>
&lt;h3 id="task-2">Task 2&lt;/h3>
&lt;p>Now we initialize the &lt;code>/home/ansible/techlab&lt;/code> folder as a local git repository and add the gitea repository
created in Task 1 as its remote.
We also do some basic git configurations.&lt;/p>
&lt;ul>
&lt;li>On the controller server go to the techlab folder&lt;/li>
&lt;li>Config &lt;code>main&lt;/code> as the default branch&lt;/li>
&lt;li>Config your name and email&lt;/li>
&lt;li>Init a git repo in the &lt;code>/home/ansible/techlab&lt;/code> folder&lt;/li>
&lt;li>Add your gitea repository as an ssh-remote
(the remote SSH user is gitea, so &lt;code>gitea@&amp;lt;yourname&amp;gt;-controller.workshop.puzzle.ch:ansible/techlab.git&lt;/code>
is what you have to set as a remote).&lt;/li>
&lt;li>Create a &lt;code>README.md&lt;/code> file with a description of your repository&lt;/li>
&lt;li>Add and commit the file &lt;code>README.md&lt;/code> with an appropriate commit message.&lt;/li>
&lt;li>Don&amp;rsquo;t push your changes yet&lt;/li>
&lt;/ul>
&lt;details >
&lt;summary>Solution Task 2&lt;/summary>
&lt;pre tabindex="0">&lt;code>cd /home/ansible/techlab
git config --global init.defaultBranch main
git config --global user.email &amp;#34;you@example.com&amp;#34;
git config --global user.name &amp;#34;Your Name&amp;#34;
git init
git remote add origin gitea@&amp;lt;yourname&amp;gt;-controller.workshop.puzzle.ch:ansible/techlab.git
echo &amp;#34;This is my Ansible Techlab repo&amp;#34; &amp;gt; README.md
git add README.md
git commit -m &amp;#34;first commit&amp;#34;
&lt;/code>&lt;/pre>&lt;/details>
&lt;h3 id="task-3">Task 3&lt;/h3>
&lt;ul>
&lt;li>In Task 2 of Lab 1.0 you created SSH keys for the user ansible on controller node&lt;/li>
&lt;li>Show the content of the SSH public key&lt;/li>
&lt;li>In the Gitea GUI, navigate to the &lt;code>Settings&lt;/code> of the user &lt;code>ansible&lt;/code>&lt;/li>
&lt;li>On the right side chose the &lt;code>SSH / GPG Keys&lt;/code> tab&lt;/li>
&lt;li>Click the &lt;code>Add Key&lt;/code> button&lt;/li>
&lt;li>Set &lt;code>ansible@&amp;lt;yourname&amp;gt;-controller&lt;/code> as &lt;code>Key Name&lt;/code> and paste the content of your public key in the &lt;code>Content&lt;/code> field of the GUI&lt;/li>
&lt;li>Click &lt;code>Add Key&lt;/code>&lt;/li>
&lt;/ul>
&lt;details >
&lt;summary>Solution Task 3&lt;/summary>
&lt;pre tabindex="0">&lt;code>cat /home/ansible/.ssh/id_ed25519.pub
&lt;/code>&lt;/pre>&lt;p>&lt;img src="git_add_sshkey_to_gitea.png" alt="Add SSH keys">&lt;/p>
&lt;/details>
&lt;h3 id="task-4">Task 4&lt;/h3>
&lt;ul>
&lt;li>Push your changes and set the upstream to &lt;code>origin main&lt;/code>&lt;/li>
&lt;li>In the Gitea GUI, check that your changes have been pushed to the remote.&lt;/li>
&lt;/ul>
&lt;details >
&lt;summary>Solution Task 4&lt;/summary>
&lt;pre tabindex="0">&lt;code>git push --set-upstream origin main
&lt;/code>&lt;/pre>&lt;p>(If you push for the first time,
check and then accept the controllers authenticity by entering &lt;code>yes&lt;/code> followed by &lt;code>&amp;lt;ENTER&amp;gt;&lt;/code>)&lt;/p>
&lt;/details></description></item></channel></rss>