<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>
	Comments on: How to Work with Ansible Variables and Facts &#8211; Part 8	</title>
	<atom:link href="https://www.tecmint.com/ansible-variables-and-facts/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.tecmint.com/ansible-variables-and-facts/</link>
	<description>Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks.</description>
	<lastBuildDate>Sun, 13 Dec 2020 15:57:34 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: journeyman.lnx		</title>
		<link>https://www.tecmint.com/ansible-variables-and-facts/comment-page-1/#comment-1400706</link>

		<dc:creator><![CDATA[journeyman.lnx]]></dc:creator>
		<pubDate>Sun, 13 Dec 2020 15:57:34 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=35303#comment-1400706</guid>

					<description><![CDATA[Is the YAML file formatting correct throughout the example of the &#039;&lt;strong&gt;Inventory Variables&lt;/strong&gt;&#039; section?

The difference in the relative indentation of webserver1 vs webserver2 doesn&#039;t seem too consistent with the initial presentation:
&lt;pre&gt;
[web_servers]

web_server_1 ansible_user=centos http_port=80
web_server_2 ansible_user=ubuntu http_port=8080
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>Is the YAML file formatting correct throughout the example of the &#8216;<strong>Inventory Variables</strong>&#8216; section?</p>
<p>The difference in the relative indentation of webserver1 vs webserver2 doesn&#8217;t seem too consistent with the initial presentation:</p>
<pre>
[web_servers]

web_server_1 ansible_user=centos http_port=80
web_server_2 ansible_user=ubuntu http_port=8080
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Marcel de Vries		</title>
		<link>https://www.tecmint.com/ansible-variables-and-facts/comment-page-1/#comment-1357260</link>

		<dc:creator><![CDATA[Marcel de Vries]]></dc:creator>
		<pubDate>Wed, 26 Aug 2020 14:05:57 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=35303#comment-1357260</guid>

					<description><![CDATA[Hello Jeff,

I tried a super simple playbook to read a dict variable:
&lt;pre&gt;
---    
hosts: instance-01
vars:  
  vlans:
    id: 10
        
tasks: 
  - name: Read dict variable
    debug:
      msg: “{{ vlans[‘id’]  }}“   
&lt;/pre&gt;
Output:
&lt;pre&gt;
ansible-playbook test_dict.yml 
[WARNING]: Skipping unexpected key (servers) in group (local), only &quot;vars&quot;, &quot;children&quot; and &quot;hosts&quot; are valid
ERROR! A playbook must be a list of plays, got a  instead
&lt;/pre&gt;
The error appears to be in &#039;/home/student/Ansible/klooien/test_dict.yml&#039;: line 2, column 1, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
hosts: instance-01
^ here

Help!]]></description>
			<content:encoded><![CDATA[<p>Hello Jeff,</p>
<p>I tried a super simple playbook to read a dict variable:</p>
<pre>
---    
hosts: instance-01
vars:  
  vlans:
    id: 10
        
tasks: 
  - name: Read dict variable
    debug:
      msg: “{{ vlans[‘id’]  }}“   
</pre>
<p>Output:</p>
<pre>
ansible-playbook test_dict.yml 
[WARNING]: Skipping unexpected key (servers) in group (local), only "vars", "children" and "hosts" are valid
ERROR! A playbook must be a list of plays, got a  instead
</pre>
<p>The error appears to be in &#8216;/home/student/Ansible/klooien/test_dict.yml&#8217;: line 2, column 1, but may<br />
be elsewhere in the file depending on the exact syntax problem.</p>
<p>The offending line appears to be:</p>
<p>&#8212;<br />
hosts: instance-01<br />
^ here</p>
<p>Help!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: James Kiarie		</title>
		<link>https://www.tecmint.com/ansible-variables-and-facts/comment-page-1/#comment-1328688</link>

		<dc:creator><![CDATA[James Kiarie]]></dc:creator>
		<pubDate>Mon, 20 Apr 2020 09:00:05 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=35303#comment-1328688</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/ansible-variables-and-facts/comment-page-1/#comment-1328325&quot;&gt;jef&lt;/a&gt;.

Hey Jeff, let me have a look at the playbook you are running to verify if the syntax is correct.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/ansible-variables-and-facts/comment-page-1/#comment-1328325">jef</a>.</p>
<p>Hey Jeff, let me have a look at the playbook you are running to verify if the syntax is correct.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jef		</title>
		<link>https://www.tecmint.com/ansible-variables-and-facts/comment-page-1/#comment-1328326</link>

		<dc:creator><![CDATA[jef]]></dc:creator>
		<pubDate>Sat, 18 Apr 2020 10:41:23 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=35303#comment-1328326</guid>

					<description><![CDATA[TASK [Install the new facts] *********************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [host2]: FAILED! =&#062; {&quot;changed&quot;: false, &quot;msg&quot;: &quot;Could not find or access &#039;custom.facts&#039;\nSearched in:\n\t/rh294/files/custom.facts\n\t/rh294/custom.facts\n\t/rh294/files/custom.facts\n\t/rh294/custom.facts on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option&quot;}]]></description>
			<content:encoded><![CDATA[<p>TASK [Install the new facts] *********************************************************************************************************************<br />
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option<br />
fatal: [host2]: FAILED! =&gt; {&#8220;changed&#8221;: false, &#8220;msg&#8221;: &#8220;Could not find or access &#8216;custom.facts&#8217;\nSearched in:\n\t/rh294/files/custom.facts\n\t/rh294/custom.facts\n\t/rh294/files/custom.facts\n\t/rh294/custom.facts on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option&#8221;}</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jef		</title>
		<link>https://www.tecmint.com/ansible-variables-and-facts/comment-page-1/#comment-1328325</link>

		<dc:creator><![CDATA[jef]]></dc:creator>
		<pubDate>Sat, 18 Apr 2020 10:40:16 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=35303#comment-1328325</guid>

					<description><![CDATA[TASK [Get custom facts] **************************************************************************************************************************
fatal: [host2]: FAILED! =&#062; {&quot;msg&quot;: &quot;The task includes an option with an undefined variable. The error was: &#039;dict object&#039; has no attribute &#039;date_time&#039;\n\nThe error appears to be in &#039;/rh294/chap4_setup_facts.yaml&#039;: line 11, column 9, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n    tasks:\n      - name: Get custom facts\n        ^ here\n&quot;}


I am getting this error when i run the above custom fact. I am using ansible;

[root@control-node rh294]# ansible --version
ansible 2.9.6
  config file = /rh294/ansible.cfg
  configured module search path = [u&#039;/root/.ansible/plugins/modules&#039;, u&#039;/usr/share/ansible/plugins/modules&#039;]
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]]]></description>
			<content:encoded><![CDATA[<p>TASK [Get custom facts] **************************************************************************************************************************<br />
fatal: [host2]: FAILED! =&gt; {&#8220;msg&#8221;: &#8220;The task includes an option with an undefined variable. The error was: &#8216;dict object&#8217; has no attribute &#8216;date_time&#8217;\n\nThe error appears to be in &#8216;/rh294/chap4_setup_facts.yaml&#8217;: line 11, column 9, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n    tasks:\n      &#8211; name: Get custom facts\n        ^ here\n&#8221;}</p>
<p>I am getting this error when i run the above custom fact. I am using ansible;</p>
<p>[root@control-node rh294]# ansible &#8211;version<br />
ansible 2.9.6<br />
  config file = /rh294/ansible.cfg<br />
  configured module search path = [u&#8217;/root/.ansible/plugins/modules&#8217;, u&#8217;/usr/share/ansible/plugins/modules&#8217;]<br />
  ansible python module location = /usr/lib/python2.7/site-packages/ansible<br />
  executable location = /usr/bin/ansible<br />
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
