Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions DC-Ansible
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file originates from the project https://github.com/openSUSE/doc-kit
# This file can be edited downstream.

MAIN="ansible.asm.xml"
# Point to the ID of the <structure> of your assembly
SRC_DIR="articles"
IMG_SRC_DIR="images"

PROFOS="sles"
PROFCONDITION="16.0"
STRUCTID="ansible"
#PROFCONDITION="suse-product;beta"
#PROFCONDITION="community-project"

STYLEROOT="/usr/share/xml/docbook/stylesheet/suse2022-ns"
FALLBACK_STYLEROOT="/usr/share/xml/docbook/stylesheet/suse-ns"
152 changes: 152 additions & 0 deletions articles/ansible.asm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-model href="https://cdn.docbook.org/schema/5.2/rng/assemblyxi.rnc"
type="application/relax-ng-compact-syntax"?>
<!DOCTYPE assembly
[
<!ENTITY % entities SYSTEM "../common/generic-entities.ent">
%entities;
]>
<assembly version="5.2" xml:lang="en"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:trans="http://docbook.org/ns/transclusion"
xmlns:its="http://www.w3.org/2005/11/its"
xmlns="http://docbook.org/ns/docbook">
<!-- R E S O U R C E S -->
<resources>
<resource href="../concepts/ansible-intro.xml" xml:id="_ansible-intro"/>
<resource href="../references/ansible-configure.xml" xml:id="_ansible-configure"/>
<resource href="../concepts/ansible-inventory-file.xml" xml:id="_ansible-inventory-file"/>
<resource href="../tasks/ansible-install.xml" xml:id="_ansible-install"/>
<resource href="../references/ansible-basic-usage.xml" xml:id="_ansible-basic-usage"/>
<resource href="../references/ansible-best-practices.xml" xml:id="_ansible-best-practices"/>
<resource href="../common/legal.xml" xml:id="_legal"/>
<resource href="../common/license_gfdl1.2.xml" xml:id="_gfdl"/>
</resources>
<!-- S T R U C T U R E -->
<structure renderas="article" xml:id="ansible" xml:lang="en">
<merge>
<title>Ansible core</title>
<revhistory xml:id="rh-ansible">
<revision><date>2025-06-19</date>
<revdescription>
<para>
Initial version
</para>
</revdescription>
</revision>
</revhistory>

<!-- Maintainer-->
<meta name="maintainer" content="[email protected]" its:translate="no"/>

<!-- Series-->
<meta name="series" its:translate="no">Smart Docs</meta>

<!-- Task -->
<meta name="task" its:translate="no">
<phrase>Administration</phrase>
<phrase>Configuration</phrase>
<phrase>Security</phrase>
</meta>

<!-- Docmanager -->
<dm:docmanager xmlns:dm="urn:x-suse:ns:docmanager">
<dm:bugtracker>
<dm:url>https://bugzilla.suse.com/enter_bug.cgi</dm:url>
<dm:component>Documentation</dm:component>
<dm:product>SUSE Linux Enterprise Server 16.0</dm:product>
<dm:assignee>[email protected]</dm:assignee>
</dm:bugtracker>
<dm:translation>yes</dm:translation>
</dm:docmanager>

<!-- Architecture -->
<meta name="architecture" its:translate="no">
<phrase>&x86-64;</phrase>
<phrase>&power;</phrase>
<phrase>&zseries;</phrase>
<phrase>&aarch64;</phrase>
</meta>

<!-- Productname & Version -->
<meta name="productname" its:translate="no">
<productname version="16">&sles;</productname>
</meta>

<!-- Social Media -->
<meta name="title" its:translate="yes">Ansible automation platform</meta>
<meta name="social-descr" its:translate="yes">Learn how to automate IT tasks using Ansible</meta>

<!-- Search -->
<meta name="description" its:translate="yes">Save time by using Ansible automation platform.</meta>

<abstract>
<variablelist>
<varlistentry>
<term>WHAT?</term>
<listitem>
<para>
This article gives an introduction to Ansible and guides you on how to automate repetitive IT tasks.
Ansible is an IT automation tool that simplifies configuration management,application deployment and
task orchestration by enabling you to define infrastructure as code in a simple way.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>WHY?</term>
<listitem>
<para>
Learn how to automate IT infrastructure with Ansible;how to install and configure, create
an inventory file and a playbook.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>EFFORT</term>
<listitem>
<para>
The average reading time of this article is approximately 40 minutes.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>REQUIREMENTS</term>
<listitem>
<itemizedlist>
<listitem>
<para>
<emphasis>Linux fundamentals:</emphasis>Understanding basic Linux commands,file permissions, directory structures
and usage of the command line.
</para>
</listitem>
<listitem>
<para>
<emphasis>Networking:</emphasis>Ansible connects to remote machines via SSH so knowledge of IP addresses,SSH,host names and pots is required.
</para>
</listitem>
<listitem>
<para>
<emphasis>YAML:</emphasis>Ansible playbooks are written in YAML so knowing how to structure a YAML file is essential.
</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
</variablelist>
</abstract>
</merge>
<module resourceref="_ansible-intro"></module>
<module resourceref="_ansible-configure">
</module>
<module resourceref="_ansible-install">
</module>
<module resourceref="_ansible-inventory-file">
</module>
<module resourceref="_ansible-basic-usage"/>
<module resourceref="_ansible-best-practices"/>
<module resourceref="_legal"/>
<module resourceref="_gfdl">
<output renderas="appendix"/>
</module>
</structure>
</assembly>
63 changes: 63 additions & 0 deletions concepts/ansible-intro.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file originates from the project https://github.com/openSUSE/doc-kit -->
<!-- This file can be edited downstream. -->
<!DOCTYPE topic
[
<!ENTITY % entities SYSTEM "../common/generic-entities.ent">
%entities;
]>
<topic xml:id="ansible-intro"
role="reference" xml:lang="en"
xmlns="http://docbook.org/ns/docbook" version="5.2"
xmlns:its="http://www.w3.org/2005/11/its"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:trans="http://docbook.org/ns/transclusion">
<info>
<title>Introduction to Ansible core</title>
<meta name="maintainer" content="[email protected]" its:translate="no"/>
<abstract>
<para>
Ansible is an open-source IT automation engine that automates provisioning, configuration management, application deployment and other IT processes.
It is simple and has agent less architecture, which means it does not require any special software installed on the machines it manages.
It operates on the following concepts: </para>
</abstract>
</info>
<itemizedlist>
<listitem>
<para>
<emphasis>Control node:</emphasis> The machine where Ansible is installed and executed. </para>
</listitem>
<listitem>
<para>
<emphasis>Managed Nodes:</emphasis> The target servers or devices that Ansible manages.
</para>
</listitem>
<listitem>
<para>
<emphasis>Inventory:</emphasis> A file that defines and groups your managed nodes.
</para>
</listitem>
<listitem>
<para>
<emphasis>Modules:</emphasis> Small programs that Ansible pushes to managed nodes to perform specific tasks.
</para>
</listitem>
<listitem>
<para>
<emphasis>Tasks:</emphasis> A single action executed by a module.
</para>
</listitem>
<listitem>
<para>
<emphasis>Playbooks:</emphasis> YAML files that contain an ordered list of tasks and define the desired state of your systems.
</para>
</listitem>
<listitem>
<para>
<emphasis>Roles:</emphasis> Structured ways to organize playbooks and other related files for reusability.
</para>
</listitem>
</itemizedlist>

</topic>
154 changes: 154 additions & 0 deletions concepts/ansible-inventory-file.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
[
<!ENTITY % entities SYSTEM "../common/generic-entities.ent">
%entities;
]>
<!-- refers to legacy doc: <add github link to legacy doc piece, if applicable> -->
<!-- point back to this document with a similar comment added to your legacy doc piece -->
<!-- refer to README.md for file and id naming conventions -->
<!-- metadata is dealt with on the assembly level -->
<topic xml:id="ansible-inventory-file"
role="reference" xml:lang="en"
xmlns="http://docbook.org/ns/docbook" version="5.2"
xmlns:its="http://www.w3.org/2005/11/its"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:trans="http://docbook.org/ns/transclusion">
<info>
<title>Structure of an inventory file</title>
<meta name="maintainer" content="[email protected]" its:translate="no"/>
<abstract>
<para>
An &ansible; inventory file defines the hosts or servers on which &ansible; commands and playbooks will run.
It can be in either <literal>INI</literal> or <literal>YAML</literal> format and is a fundamental component of an Ansible project.
</para>
</abstract>
</info>
<para>Ansible uses several built-in variables to connect to and manage hosts, which are often defined in the inventory file.
The most common ones are:</para>
<itemizedlist>
<listitem><para><literal>ansible_host:</literal>Specifies the IP address or DNS name of the host.</para>
</listitem>
<listitem><para><literal>ansible_user</literal>The user account to use for SSH connections.</para>
</listitem>
<listitem><para><literal>ansible_port:</literal>The path to the private key file for authentication.</para>
</listitem>
<listitem><para><literal>ansible_private_key_file:</literal>Specifies the IP address or DNS name of the host.</para>
</listitem>
<listitem><para><literal>ansible_python_interpreter:</literal>Specifies the path to the Python interpreter on the remote host if it is not the default.</para>
</listitem>
</itemizedlist>
<section xml:id="inventory-ini">
<title><literal>INI</literal>format</title>
<para>The <literal>INI</literal> format is the more traditional and widely used format for inventory files.
Hosts can be listed individually or grouped together.</para>
<variablelist>
<varlistentry>
<term><emphasis>Individual hosts</emphasis> </term>
<listitem>
<para>You can either list the IP addresses or host names. For example:</para>
<screen>host1.example.com
192.168.1.50</screen>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Groups</emphasis> </term>
<listitem>
<para>Groups are defined using <literal>[]</literal> brackets. You can apply tasks to multiple hosts simultaneously.
A host can belong to multiple groups. For example:</para>
<screen>[webservers]
web1.example.com
web2.example.com

[databases]
db1.example.com</screen>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Group variables</emphasis> </term>
<listitem>
<para>Variables can be assigned to all hosts within a specific group.
These are defined under the group name using a <literal>:vars</literal> suffix. For example:</para>
<screen>[webservers:vars]
ansible_user=test
http_port=80</screen>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Child groups</emphasis> </term>
<listitem>
<para> You can create a group of groups, known as a parent group, using the <literal>:children</literal> suffix.
This is useful for combining different host types for a single task. For example:</para>
<screen>[all_servers:children]
webservers
databases</screen>
</listitem>
</varlistentry>
</variablelist>
</section>
<section xml:id="inventory-yaml">
<title><literal>YAML</literal>format</title>
<para>YAML offers a structured and hierarchical way to represent the inventory.
It is often preferred for its readability and ability to handle complex data structures.</para>
<variablelist>
<varlistentry>
<term><emphasis>Host and group structure:</emphasis> </term>
<listitem>
<para>The inventory is defined under the <literal>all</literal> keyword, which contains
hosts and children. For example,</para>
<screen>all:
hosts:
host1.example.com:
192.168.1.50:
children:
webservers:
hosts:
web1.example.com:
web2.example.com:
databases:
hosts:
db1.example.com:</screen>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Group and host variables</emphasis> </term>
<listitem>
<para>Variables are defined under a <literal>vars</literal> dictionary within the host or group.
For example:</para>
<screen>[webservers]
web1.example.com
web2.example.com

[databases]
db1.example.com</screen>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Group variables</emphasis> </term>
<listitem>
<para>Variables can be assigned to all hosts within a specific group.
These are defined under the group name using a <literal>:vars</literal> suffix. For example:</para>
<screen>[webservers:vars]
ansible_user=test
http_port=80</screen>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Child groups</emphasis> </term>
<listitem>
<para> You can create a group of groups, known as a parent group, using the <literal>:children</literal> suffix.
This is useful for combining different host types for a single task. For example:</para>
<screen>all:
children:
webservers:
hosts:
web1.example.com:
ansible_user: test
vars:
http_port: 80</screen>
</listitem>
</varlistentry>
</variablelist>
</section>
</topic>
Loading