<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Brian</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Brian"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Brian"/>
	<updated>2026-04-27T14:28:06Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Ansible&amp;diff=15777</id>
		<title>Ansible</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Ansible&amp;diff=15777"/>
		<updated>2019-03-10T04:56:12Z</updated>

		<summary type="html">&lt;p&gt;Brian: /* Setup hosts */  Fixed broken link to Ansible documentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://ansible.com/ ansible] is a simple configuration management, deployment, task-execution, and multinode orchestration framework. It uses SSH for the communication between the involved systems, no server or client daemons are needed, and no additional software beside Python on client boxes is required.&lt;br /&gt;
&lt;br /&gt;
= Installation of ansible =&lt;br /&gt;
ansible is available in &#039;&#039;testing&#039;&#039;. The latest package is broken, sorry.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add ansible}}&lt;br /&gt;
&lt;br /&gt;
== Create a SSH key ==&lt;br /&gt;
Generate a SSH key for the managed node. It&#039;s recommended to use a key which is protected with a password.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ssh-keygen -t rsa}}&lt;br /&gt;
&lt;br /&gt;
= Managed nodes =&lt;br /&gt;
There are only minimal requirements for the clients. For every system you want to manage, you need to have the client&#039;s SSH key in the &amp;lt;code&amp;gt;authorized_keys&amp;lt;/code&amp;gt; file of the management system and Python.&lt;br /&gt;
&lt;br /&gt;
Install the Python package.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add python}}&lt;br /&gt;
&lt;br /&gt;
== Transfer the SSH key ==&lt;br /&gt;
There are two ways to do it. From a default Alpine installation you can use ssh and cat to do it.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;ssh root@[IP of the management system] &#039;cat ~/.ssh/id_rsa.pub&#039; | cat - &amp;gt;&amp;gt; ~/.ssh/authorized_keys&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
If you are planning to use additional features of SSH. &amp;lt;code&amp;gt;ssh-copy-id&amp;lt;/code&amp;gt;, which is provided by the &amp;lt;code&amp;gt;openssh-client&amp;lt;/code&amp;gt; package, can help you with the key setup. &lt;br /&gt;
&lt;br /&gt;
{{Cmd|ssh-copy-id -i ~/.ssh/id_rsa.pub root@[IP of the management system]}}&lt;br /&gt;
&lt;br /&gt;
= Setup hosts =&lt;br /&gt;
Add all your remote systems to &amp;lt;code&amp;gt;/etc/ansible/hosts&amp;lt;/code&amp;gt;. For details, please refer to [https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#hosts-and-groups Hosts and Groups] in the ansible documentation.&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/ansible/hosts|&lt;br /&gt;
192.168.1.50&lt;br /&gt;
10.0.0.12&lt;br /&gt;
webserver.example.org&lt;br /&gt;
mail.example.org}}&lt;br /&gt;
&lt;br /&gt;
= First test =&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ ansible all -m ping -u you --sudo}}&lt;br /&gt;
&lt;br /&gt;
Another test is check all variables.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# ansible [IP of your Alpine Linux box] -m setup}}&lt;br /&gt;
&lt;br /&gt;
= Playbooks =&lt;br /&gt;
When writing playbooks for Alpine Linux there are modules to keep in mind:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;There is support for OpenRC, the [[Alpine_Linux_Init_System|Init System]], in the service module.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- service:&lt;br /&gt;
   name: lighttpd&lt;br /&gt;
   enabled: yes&lt;br /&gt;
   state: started&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;There is support for [[Alpine_Linux_package_management|APK]] as of Ansible 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- apk:&lt;br /&gt;
   name: lighttpd&lt;br /&gt;
   state: present&lt;br /&gt;
   update_cache: yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;There is support for the [[Alpine_Wall|Awall]] firewall as of Ansible 2.4.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- awall:&lt;br /&gt;
   name: policyfile&lt;br /&gt;
   state: enabled&lt;br /&gt;
   activate: yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you are going to re-use playbooks from other Linux distribution, please keep in mind that Alpine Linux uses different paths for the binaries. &amp;lt;code&amp;gt;/bin/rm&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [http://git.alpinelinux.org/cgit/fab/alpine-ansible/ alpine-ansible git repository] contain some example playbooks. &lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
*[[Ansible APK Module]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Brian</name></author>
	</entry>
</feed>