<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Local mode Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/local-mode/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/local-mode/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:07:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Run Ansible Adhoc commands or playbook in Local mode</title>
		<link>https://www.scmgalaxy.com/tutorials/run-ansible-adhoc-commands-or-playbook-in-local-mode/</link>
					<comments>https://www.scmgalaxy.com/tutorials/run-ansible-adhoc-commands-or-playbook-in-local-mode/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Thu, 06 Sep 2018 06:51:08 +0000</pubDate>
				<category><![CDATA[Ansible]]></category>
		<category><![CDATA[Adhoc]]></category>
		<category><![CDATA[Local mode]]></category>
		<category><![CDATA[localhost]]></category>
		<category><![CDATA[Playbook]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=5294</guid>

					<description><![CDATA[<p>If you are trying to run Ansible Adhoc commands or playbook in Local mode, these articles will help you. Ansible [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/run-ansible-adhoc-commands-or-playbook-in-local-mode/">Run Ansible Adhoc commands or playbook in Local mode</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>If you are trying to run Ansible Adhoc commands or playbook in Local mode, these articles will help you.</p>
<p>Ansible can&#8217;t run playbooks locally without ssh if ansible_connection=local is defined in the hosts file, although it can run playbooks locally without ssh with connection: local in the playbook or with flag &#8211;connection=local.</p>
<p><strong># # # # # # # # # # # # Method 1 # # # # # # # # # # # # # # # # # #</strong></p>
<pre class="brush: plain; title: ; notranslate">ansible 127.0.0.1 -m file -a &quot;dest=/opt/a.txt mode=600 state=touch&quot;
ansible 127.0.0.1 -m file -a &quot;dest=/opt/a.txt mode=600 state=file&quot;</pre>
<p><strong># # # # # # # # # # # # Method 2 # # # # # # # # # # # # # # # # # #</strong></p>
<pre class="brush: plain; title: ; notranslate">Inventory file
127.0.0.1 ansible_connection=local
localhost ansible_connection=local</pre>
<p><strong># # # # # # # # # # # # Method 3 # # # # # # # # # # # # # # # # # #</strong></p>
<pre class="brush: plain; title: ; notranslate">---

- name: run the playbook tasks on the localhost
hosts: 127.0.0.1
connection: local
become: yes
tasks:

- name: print out the hostname of target
command: hostname

- name: ensure aptitude is installed
command: apt-get -y install aptitude

- name: update the apt package index i.e. apt-get update
apt: update_cache=yes

- name: upgrade system packages i.e. apt-get upgrade
apt: upgrade=yes

</pre>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/run-ansible-adhoc-commands-or-playbook-in-local-mode/">Run Ansible Adhoc commands or playbook in Local mode</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/run-ansible-adhoc-commands-or-playbook-in-local-mode/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
