mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-01 20:50:23 -07:00
Add yum module to examples + playbook examples
This commit is contained in:
parent
8bf7e79ee3
commit
a13def0fbe
8 changed files with 36 additions and 9 deletions
|
@ -130,6 +130,7 @@ s.parentNode.insertBefore(ga, s);
|
|||
<li><a class="reference internal" href="#">Command Line Examples</a><ul>
|
||||
<li><a class="reference internal" href="#parallelism-and-shell-commands">Parallelism and Shell Commands</a></li>
|
||||
<li><a class="reference internal" href="#file-transfer-templating">File Transfer & Templating</a></li>
|
||||
<li><a class="reference internal" href="#managing-packages">Managing Packages</a></li>
|
||||
<li><a class="reference internal" href="#deploying-from-source-control">Deploying From Source Control</a></li>
|
||||
<li><a class="reference internal" href="#managing-services">Managing Services</a></li>
|
||||
<li><a class="reference internal" href="#time-limited-background-operations">Time Limited Background Operations</a></li>
|
||||
|
@ -224,6 +225,24 @@ ansible webservers -m template -a "src=/srv/ntp.j2 dest=/etc/ntp.conf"</pre>
|
|||
installed, data from these projects will also be made available to the
|
||||
template engine, using ‘facter’ and ‘ohai’ prefixes for each.</p>
|
||||
</div>
|
||||
<div class="section" id="managing-packages">
|
||||
<h2>Managing Packages<a class="headerlink" href="#managing-packages" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Ensure a package is installed, but don’t update it:</p>
|
||||
<div class="highlight-python"><pre>ansible webservers -m yum -a "pkg=acme state=installed"</pre>
|
||||
</div>
|
||||
<p>Ensure a package is installed to a specific version:</p>
|
||||
<div class="highlight-python"><pre>ansible-webservers -m yum -a "pkg=acme-1.5 state=installed"</pre>
|
||||
</div>
|
||||
<p>Ensure a package is at the latest version:</p>
|
||||
<div class="highlight-python"><pre>ansible webservers -m yum -a "pkg=acme state=latest"</pre>
|
||||
</div>
|
||||
<p>Ensure a package is not installed:</p>
|
||||
<blockquote>
|
||||
<div>ansible-webservers -m yum -a “pkg=acme state=removed”</div></blockquote>
|
||||
<p>Currently Ansible only has a module for managing packages with yum. You can install
|
||||
for other package manages using the command module or contribute a module
|
||||
for other package managers. Stop by the mailing list for info/details.</p>
|
||||
</div>
|
||||
<div class="section" id="deploying-from-source-control">
|
||||
<h2>Deploying From Source Control<a class="headerlink" href="#deploying-from-source-control" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Deploy your webapp straight from git:</p>
|
||||
|
@ -237,10 +256,13 @@ directly from git and then restarting apache.</p>
|
|||
<div class="section" id="managing-services">
|
||||
<h2>Managing Services<a class="headerlink" href="#managing-services" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Ensure a service is started on all webservers:</p>
|
||||
<div class="highlight-python"><pre>ansible webservers -m service name=httpd state=started</pre>
|
||||
<div class="highlight-python"><pre>ansible webservers -m service -a "name=httpd state=started"</pre>
|
||||
</div>
|
||||
<p>Alternatively, restart a service on all webservers:</p>
|
||||
<div class="highlight-python"><pre>ansible webservers -m service name=httpd state=restarted</pre>
|
||||
<div class="highlight-python"><pre>ansible webservers -m service -a "name=httpd state=restarted"</pre>
|
||||
</div>
|
||||
<p>Ensure a service is stopped:</p>
|
||||
<div class="highlight-python"><pre>ansible webservers -m service -a "name=httpd state=stopped"</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="time-limited-background-operations">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue