
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.thelinuxwiki.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.thelinuxwiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nighthawk</id>
		<title>thelinuxwiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.thelinuxwiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nighthawk"/>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/Special:Contributions/Nighthawk"/>
		<updated>2026-04-28T23:16:42Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.21.5</generator>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/openvpn_TSL_unsupported_protocol</id>
		<title>openvpn TSL unsupported protocol</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/openvpn_TSL_unsupported_protocol"/>
				<updated>2026-01-05T20:08:28Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: Created page with &amp;quot; == environment == OpenWrt 24.10.4    == errors ==   Mon Jan  5 13:44:54 2026 daemon.notice openvpn(junkervpn)[17226]: TLS: Initial packet from [AF_INET]10.0.0.117:11194, sid=...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== environment ==&lt;br /&gt;
OpenWrt 24.10.4 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== errors ==&lt;br /&gt;
&lt;br /&gt;
 Mon Jan  5 13:44:54 2026 daemon.notice openvpn(junkervpn)[17226]: TLS: Initial packet from [AF_INET]10.0.0.117:11194, sid=a48ff4a0 b182fbd1&lt;br /&gt;
 Mon Jan  5 13:44:54 2026 daemon.err openvpn(junkervpn)[17226]: TLS error: Unsupported protocol. This typically indicates that client and server have no common TLS version enabled. This can be caused by mismatched tls-version-min and tls-version-max options on client and server. If your OpenVPN client is between v2.3.6 and v2.3.2 try adding tls-version-min 1.0 to the client configuration to use TLS 1.0+ instead of TLS 1.0 only&lt;br /&gt;
 Mon Jan  5 13:44:54 2026 daemon.err openvpn(junkervpn)[17226]: OpenSSL: error:0A000102:SSL routines::unsupported protocol:&lt;br /&gt;
 Mon Jan  5 13:44:54 2026 daemon.err openvpn(junkervpn)[17226]: TLS_ERROR: BIO read tls_read_plaintext error&lt;br /&gt;
 Mon Jan  5 13:44:54 2026 daemon.err openvpn(junkervpn)[17226]: TLS Error: TLS object -&amp;gt; incoming plaintext read error&lt;br /&gt;
 Mon Jan  5 13:44:54 2026 daemon.err openvpn(junkervpn)[17226]: TLS Error: TLS handshake failed&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== root cause ==&lt;br /&gt;
tls version mismatch. need to enable 1.0 on the connecting client device.&lt;br /&gt;
&lt;br /&gt;
== solution ==&lt;br /&gt;
&lt;br /&gt;
add the following line to the appropriate conf file in /etc/openvpn/ directory&lt;br /&gt;
 tls-version-min 1.0 &lt;br /&gt;
&lt;br /&gt;
[[category:openvpn]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_fiortios_api_login_failure</id>
		<title>ansible fiortios api login failure</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_fiortios_api_login_failure"/>
				<updated>2025-12-19T15:50:32Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;fortios version: 7.4.5 &lt;br /&gt;
&lt;br /&gt;
error(from ansible): ansible.module_utils.connection.ConnectionError: Expecting value: line 1 column 1 (char 0)&lt;br /&gt;
&lt;br /&gt;
description: login with access_token failing from ansible to fortios. logging in with same token via curl is working.&lt;br /&gt;
&lt;br /&gt;
solution:&lt;br /&gt;
&lt;br /&gt;
check the following setting&lt;br /&gt;
&lt;br /&gt;
 foritos # show full-configuration | grep rest-api-key-url-query&lt;br /&gt;
    set rest-api-key-url-query disabled&lt;br /&gt;
&lt;br /&gt;
if disabled then do...&lt;br /&gt;
&lt;br /&gt;
 foritos # config global&lt;br /&gt;
 foritos # config system global&lt;br /&gt;
 foritos (global) # set rest-api-key-url-query enable&lt;br /&gt;
 foritos (global) # end&lt;br /&gt;
 &lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
[[category:fortinet]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_fiortios_api_login_failure</id>
		<title>ansible fiortios api login failure</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_fiortios_api_login_failure"/>
				<updated>2025-12-19T15:48:21Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;fortios version: 7.4.5 &lt;br /&gt;
&lt;br /&gt;
error(from ansible): ansible.module_utils.connection.ConnectionError: Expecting value: line 1 column 1 (char 0)&lt;br /&gt;
&lt;br /&gt;
description: login with access_token failing from ansible to fortios. logging in with same token via curl is working.&lt;br /&gt;
&lt;br /&gt;
solution:&lt;br /&gt;
&lt;br /&gt;
check the following setting&lt;br /&gt;
&lt;br /&gt;
 foritos # show full-configuration | grep rest-api-key-url-query&lt;br /&gt;
    set rest-api-key-url-query disabled&lt;br /&gt;
&lt;br /&gt;
if disabled then do...&lt;br /&gt;
&lt;br /&gt;
 foritos # config global&lt;br /&gt;
 foritos (global) # set rest-api-key-url-query enable&lt;br /&gt;
 foritos (global) # end&lt;br /&gt;
 &lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
[[category:fortinet]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_fiortios_api_login_failure</id>
		<title>ansible fiortios api login failure</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_fiortios_api_login_failure"/>
				<updated>2025-12-19T15:46:53Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;fortios version: 7.4.5 &lt;br /&gt;
&lt;br /&gt;
error(from ansible): ansible.module_utils.connection.ConnectionError: Expecting value: line 1 column 1 (char 0)&lt;br /&gt;
&lt;br /&gt;
description: login with access_token failing from ansible to fortios. logging in with same token via curl is working.&lt;br /&gt;
&lt;br /&gt;
solution:&lt;br /&gt;
&lt;br /&gt;
check the following setting&lt;br /&gt;
&lt;br /&gt;
 foritos # show full-configuration | grep rest-api-key-url-query&lt;br /&gt;
    set rest-api-key-url-query disabled&lt;br /&gt;
&lt;br /&gt;
if disabled then do...&lt;br /&gt;
&lt;br /&gt;
 foritos # config system global&lt;br /&gt;
 foritos (global) # set rest-api-key-url-query enable&lt;br /&gt;
 foritos (global) # end&lt;br /&gt;
 &lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
[[category:fortinet]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/openwrt_notes</id>
		<title>openwrt notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/openwrt_notes"/>
				<updated>2025-12-12T17:44:32Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: Nighthawk moved page openwrt guide to openwrt notes without leaving a redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
==changing network setting==&lt;br /&gt;
&lt;br /&gt;
Edit /etc/config/network directly&lt;br /&gt;
&lt;br /&gt;
Run /etc/init.d/network restart&lt;br /&gt;
&lt;br /&gt;
===disabling ipv6===&lt;br /&gt;
&lt;br /&gt;
 uci set 'network.lan.ipv6=off'&lt;br /&gt;
 uci set 'network.wan.ipv6=off'&lt;br /&gt;
 uci set 'dhcp.lan.dhcpv6=disabled'&lt;br /&gt;
 /etc/init.d/odhcpd disable&lt;br /&gt;
 uci commit&lt;br /&gt;
&lt;br /&gt;
===installing openssh===&lt;br /&gt;
&lt;br /&gt;
[https://openwrt.org/docs/guide-user/services/ssh/openssh_instead_dropbear Replace Dropbear to OpenSSH + SFTP]&lt;br /&gt;
&lt;br /&gt;
[[category:openwrt]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/openvpn_TLS_handshake_failed</id>
		<title>openvpn TLS handshake failed</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/openvpn_TLS_handshake_failed"/>
				<updated>2025-11-11T17:57:42Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* errors */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==problem==&lt;br /&gt;
openvpn connection fails &lt;br /&gt;
&lt;br /&gt;
==errors== &lt;br /&gt;
VERIFY ERROR: depth=0, error='''unable to get local issuer certificate''': CN=johnsmith&lt;br /&gt;
&amp;lt;br&amp;gt;vpnserver openvpn[3573]: 192.168.1.100:60754 TLS_ERROR: BIO read tls_read_plaintext error: &amp;lt;br&amp;gt;error:140890B2:SSL routines:SSL3_GET_CLIENT_CERTIFICATE:no certificate returned&lt;br /&gt;
&amp;lt;br&amp;gt;vpnserver openvpn[3573]: 192.168.1.100:60754 TLS Error: TLS object -&amp;gt; incoming plaintext read error&lt;br /&gt;
&amp;lt;br&amp;gt;vpnserver openvpn[3573]: 192.168.1.100:60754 TLS Error: TLS handshake failed&lt;br /&gt;
&lt;br /&gt;
==root cause==&lt;br /&gt;
certificate issue. &lt;br /&gt;
&lt;br /&gt;
==solution==&lt;br /&gt;
generate and new crt and key with the appropriate CA&lt;br /&gt;
[[category:openvpn]]&lt;br /&gt;
[[category:openssl]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/view_ESXi_arp_cache</id>
		<title>view ESXi arp cache</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/view_ESXi_arp_cache"/>
				<updated>2025-10-22T18:38:47Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ESXi version 6.5.0&lt;br /&gt;
&lt;br /&gt;
to discover if IPs are in use or not...&lt;br /&gt;
&lt;br /&gt;
ssh to esxi host (if enabled), ping range with script like...&lt;br /&gt;
 [admin@localhost:~] '''for i in `seq 254`; do ping 192.168.0.$i -c 1 -W 1 | grep &amp;quot;1 packets received, 0% packet loss&amp;quot; &amp;amp;&amp;gt; /dev/null; if [ &amp;quot;$?&amp;quot; == &amp;quot;0&amp;quot; ]; then echo &amp;quot;192.168.0.$i is USED!!!!&amp;quot;; fi; done'''&lt;br /&gt;
 192.168.0.1 is USED!!!!&lt;br /&gt;
 192.168.0.4 is USED!!!!&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
view arp cache with command...&lt;br /&gt;
&lt;br /&gt;
 [admin@@localhost:~] '''esxcli network ip neighbor list'''&lt;br /&gt;
 Neighbor      Mac Address        Vmknic    Expiry  State  Type&lt;br /&gt;
 ------------  -----------------  ------  --------  -----  -------&lt;br /&gt;
 192.168.0.1  00:12:ef:34:cd:67  vmk0      -4 sec         Unknown&lt;br /&gt;
 192.168.0.2  (incomplete)       vmk0      -2 sec         Unknown&lt;br /&gt;
 192.168.0.3  (incomplete)       vmk0      -2 sec         Unknown&lt;br /&gt;
 192.168.0.4  b4:05:43:03:41:fc  vmk0      -2 sec         Unknown&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
[[category:vmware]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/view_ESXi_arp_cache</id>
		<title>view ESXi arp cache</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/view_ESXi_arp_cache"/>
				<updated>2025-10-22T18:38:19Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ESXi version 6.5.0&lt;br /&gt;
&lt;br /&gt;
to discover if IPs are in use or not...&lt;br /&gt;
&lt;br /&gt;
ssh to esxi host (if enabled), ping range with script like...&lt;br /&gt;
 [admin@localhost:~] '''for i in `seq 254`; do ping 192.168.0.$i -c 1 -W 1 | grep &amp;quot;1 packets received, 0% packet loss&amp;quot; &amp;amp;&amp;gt; /dev/null; if [ &amp;quot;$?&amp;quot; == &amp;quot;0&amp;quot; ]; then echo &amp;quot;192.168.0.$i is USED!!!!&amp;quot;; fi; done'''&lt;br /&gt;
 192.168.0.1 is USED!!!!&lt;br /&gt;
1 packets transmitted, 1 packets received, 0% packet loss&lt;br /&gt;
 192.168.0.4 is USED!!!!&lt;br /&gt;
&lt;br /&gt;
view arp cache with command...&lt;br /&gt;
&lt;br /&gt;
 [admin@@localhost:~] '''esxcli network ip neighbor list'''&lt;br /&gt;
 Neighbor      Mac Address        Vmknic    Expiry  State  Type&lt;br /&gt;
 ------------  -----------------  ------  --------  -----  -------&lt;br /&gt;
 192.168.0.1  00:12:ef:34:cd:67  vmk0      -4 sec         Unknown&lt;br /&gt;
 192.168.0.2  (incomplete)       vmk0      -2 sec         Unknown&lt;br /&gt;
 192.168.0.3  (incomplete)       vmk0      -2 sec         Unknown&lt;br /&gt;
 192.168.0.4  b4:05:43:03:41:fc  vmk0      -2 sec         Unknown&lt;br /&gt;
&lt;br /&gt;
[[category:vmware]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/view_ESXi_arp_cache</id>
		<title>view ESXi arp cache</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/view_ESXi_arp_cache"/>
				<updated>2025-10-22T18:38:04Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ESXi version 6.5.0&lt;br /&gt;
&lt;br /&gt;
to discover if IPs are in use or not...&lt;br /&gt;
&lt;br /&gt;
ssh to esxi host (if enabled), ping range with script like...&lt;br /&gt;
 [admin@localhost:~] '''for i in `seq 254`; do ping 192.168.0.$i -c 1 -W 1 | grep &amp;quot;1 packets received, 0% packet&lt;br /&gt;
loss&amp;quot; &amp;amp;&amp;gt; /dev/null; if [ &amp;quot;$?&amp;quot; == &amp;quot;0&amp;quot; ]; then echo &amp;quot;192.168.0.$i is USED!!!!&amp;quot;; fi; done'''&lt;br /&gt;
 192.168.0.1 is USED!!!!&lt;br /&gt;
1 packets transmitted, 1 packets received, 0% packet loss&lt;br /&gt;
 192.168.0.4 is USED!!!!&lt;br /&gt;
&lt;br /&gt;
view arp cache with command...&lt;br /&gt;
&lt;br /&gt;
 [admin@@localhost:~] '''esxcli network ip neighbor list'''&lt;br /&gt;
 Neighbor      Mac Address        Vmknic    Expiry  State  Type&lt;br /&gt;
 ------------  -----------------  ------  --------  -----  -------&lt;br /&gt;
 192.168.0.1  00:12:ef:34:cd:67  vmk0      -4 sec         Unknown&lt;br /&gt;
 192.168.0.2  (incomplete)       vmk0      -2 sec         Unknown&lt;br /&gt;
 192.168.0.3  (incomplete)       vmk0      -2 sec         Unknown&lt;br /&gt;
 192.168.0.4  b4:05:43:03:41:fc  vmk0      -2 sec         Unknown&lt;br /&gt;
&lt;br /&gt;
[[category:vmware]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/view_ESXi_arp_cache</id>
		<title>view ESXi arp cache</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/view_ESXi_arp_cache"/>
				<updated>2025-10-22T18:30:29Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: Created page with &amp;quot;ESXi version 6.5.0  to discover if IPs are in use or not...  ssh to esxi host (if enabled), ping range with script like...  admin@localhost:`&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ESXi version 6.5.0&lt;br /&gt;
&lt;br /&gt;
to discover if IPs are in use or not...&lt;br /&gt;
&lt;br /&gt;
ssh to esxi host (if enabled), ping range with script like...&lt;br /&gt;
 admin@localhost:`&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition</id>
		<title>resize regular luks partition</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition"/>
				<updated>2025-08-02T15:18:12Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I replaced a 750GB drive with a 1TB.  I copied the old partitions over with dd.  The problem is that the partitions didn't make use of the extra space.  So, I needed to grow them.  There is nothing special about the luks it seems.  You just need to decrypt the drive and then proceed as if it was a regular file system.  I performed the following steps with it unmounted.  You can do it mounted.  I just chose not to.&lt;br /&gt;
&lt;br /&gt;
Grow the partition size.&lt;br /&gt;
&lt;br /&gt;
 localhost ~ # '''parted /dev/sdb'''&lt;br /&gt;
 GNU Parted 3.2&lt;br /&gt;
 Using /dev/sdb&lt;br /&gt;
 Welcome to GNU Parted! Type 'help' to view a list of commands.&lt;br /&gt;
 (parted) resizepart 1                                                     &lt;br /&gt;
 End?  [750GB]? 1000GB&lt;br /&gt;
&lt;br /&gt;
Grow the filesystem&lt;br /&gt;
&lt;br /&gt;
 localhost ~ # '''resize2fs /dev/sdb1'''&lt;br /&gt;
 resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
 resize2fs: Device or resource busy while trying to open /dev/sdb1&lt;br /&gt;
 Couldnt find valid filesystem superblock.&lt;br /&gt;
&lt;br /&gt;
woops, I specified the wrong device name.  I need to use the dev mapper name...&lt;br /&gt;
&lt;br /&gt;
 localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
 resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
 Please run 'e2fsck -f /dev/mapper/vol1' first.&lt;br /&gt;
&lt;br /&gt;
whatever you say sir&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 localhost ~ # '''e2fsck -f /dev/mapper/vol1'''&lt;br /&gt;
 e2fsck 1.43.1 (08-Jun-2016)&lt;br /&gt;
 Pass 1: Checking inodes, blocks, and sizes&lt;br /&gt;
 Inode 18612229 extent tree (at level 2) could be narrower.  Fix&amp;lt;y&amp;gt;? yes&lt;br /&gt;
 ...&lt;br /&gt;
 /dev/mapper/vol1: ***** FILE SYSTEM WAS MODIFIED *****&lt;br /&gt;
 /dev/mapper/vol1: 352906/45793280 files (0.3% non-contiguous), 160544229/183142878 blocks&lt;br /&gt;
 localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
 resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
 Resizing the filesystem on /dev/mapper/vol1 to 244139857 (4k) blocks.&lt;br /&gt;
 The filesystem on /dev/mapper/vol1 is now 244139857 (4k) blocks long.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
[[category:disk]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition</id>
		<title>resize regular luks partition</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition"/>
				<updated>2025-08-02T15:17:55Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I replaced a 750GB drive with a 1TB.  I copied the old partitions over with dd.  The problem is that the partitions didn't make use of the extra space.  So, I needed to grow them.  There is nothing special about the luks it seems.  You just need to decrypt the drive and then proceed as if it was a regular file system.  I performed the following steps with it unmounted.  You can do it mounted.  I just chose not to.&lt;br /&gt;
&lt;br /&gt;
Grow the partition size.&lt;br /&gt;
&lt;br /&gt;
 localhost ~ # '''parted /dev/sdb'''&lt;br /&gt;
 GNU Parted 3.2&lt;br /&gt;
 Using /dev/sdb&lt;br /&gt;
 Welcome to GNU Parted! Type 'help' to view a list of commands.&lt;br /&gt;
 (parted) resizepart 1                                                     &lt;br /&gt;
 End?  [750GB]? 1000GB&lt;br /&gt;
&lt;br /&gt;
Grow the filesystem&lt;br /&gt;
&lt;br /&gt;
 localhost ~ # '''resize2fs /dev/sdb1'''&lt;br /&gt;
 resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
 resize2fs: Device or resource busy while trying to open /dev/sdb1&lt;br /&gt;
 Couldnt find valid filesystem superblock.&lt;br /&gt;
&lt;br /&gt;
woops, I specified the wrong device name.  I need to use the dev mapper name...&lt;br /&gt;
&lt;br /&gt;
 localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
 resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
 Please run 'e2fsck -f /dev/mapper/vol1' first.&lt;br /&gt;
&lt;br /&gt;
whatever you say sir&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 localhost ~ # '''e2fsck -f /dev/mapper/vol1'''&lt;br /&gt;
 e2fsck 1.43.1 (08-Jun-2016)&lt;br /&gt;
 Pass 1: Checking inodes, blocks, and sizes&lt;br /&gt;
 Inode 18612229 extent tree (at level 2) could be narrower.  Fix&amp;lt;y&amp;gt;? yes&lt;br /&gt;
 ...&lt;br /&gt;
 /dev/mapper/vol1: ***** FILE SYSTEM WAS MODIFIED *****&lt;br /&gt;
 /dev/mapper/vol1: 352906/45793280 files (0.3% non-contiguous), 160544229/183142878 blocks&lt;br /&gt;
&lt;br /&gt;
 localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
 resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
 Resizing the filesystem on /dev/mapper/vol1 to 244139857 (4k) blocks.&lt;br /&gt;
 The filesystem on /dev/mapper/vol1 is now 244139857 (4k) blocks long.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
[[category:disk]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition</id>
		<title>resize regular luks partition</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition"/>
				<updated>2025-08-02T15:16:43Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I replaced a 750GB drive with a 1TB.  I copied the old partitions over with dd.  The problem is that the partitions didn't make use of the extra space.  So, I needed to grow them.  There is nothing special about the luks it seems.  You just need to decrypt the drive and then proceed as if it was a regular file system.  I performed the following steps with it unmounted.  You can do it mounted.  I just chose not to.&lt;br /&gt;
&lt;br /&gt;
Grow the partition size.&lt;br /&gt;
&lt;br /&gt;
 # '''parted /dev/sdb'''&lt;br /&gt;
 GNU Parted 3.2&lt;br /&gt;
 Using /dev/sdb&lt;br /&gt;
 Welcome to GNU Parted! Type 'help' to view a list of commands.&lt;br /&gt;
 (parted) resizepart 1                                                     &lt;br /&gt;
 End?  [750GB]? 1000GB&lt;br /&gt;
&lt;br /&gt;
Grow the filesystem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''resize2fs /dev/sdb1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
resize2fs: Device or resource busy while trying to open /dev/sdb1&lt;br /&gt;
Couldnt find valid filesystem superblock.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
woops, I specified the wrong device name.  I need to use the dev mapper name...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
Please run 'e2fsck -f /dev/mapper/vol1' first.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
whatever you say sir&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''e2fsck -f /dev/mapper/vol1'''&lt;br /&gt;
e2fsck 1.43.1 (08-Jun-2016)&lt;br /&gt;
Pass 1: Checking inodes, blocks, and sizes&lt;br /&gt;
Inode 18612229 extent tree (at level 2) could be narrower.  Fix&amp;lt;y&amp;gt;? yes&lt;br /&gt;
...&lt;br /&gt;
/dev/mapper/vol1: ***** FILE SYSTEM WAS MODIFIED *****&lt;br /&gt;
/dev/mapper/vol1: 352906/45793280 files (0.3% non-contiguous), 160544229/183142878 blocks&lt;br /&gt;
&lt;br /&gt;
localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
Resizing the filesystem on /dev/mapper/vol1 to 244139857 (4k) blocks.&lt;br /&gt;
The filesystem on /dev/mapper/vol1 is now 244139857 (4k) blocks long.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
[[category:disk]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition</id>
		<title>resize regular luks partition</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition"/>
				<updated>2025-08-02T15:16:03Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I replaced a 750GB drive with a 1TB.  I copied the old partitions over with dd.  The problem is that the partitions didn't make use of the extra space.  So, I needed to grow them.  There is nothing special about the luks it seems.  You just need to decrypt the drive and then proceed as if it was a regular file system.  I performed the following steps with it unmounted.  You can do it mounted.  I just chose not to.&lt;br /&gt;
&lt;br /&gt;
Grow the partition size.&lt;br /&gt;
&lt;br /&gt;
# '''parted /dev/sdb'''&lt;br /&gt;
GNU Parted 3.2&lt;br /&gt;
Using /dev/sdb&lt;br /&gt;
Welcome to GNU Parted! Type 'help' to view a list of commands.&lt;br /&gt;
(parted) resizepart 1                                                     &lt;br /&gt;
End?  [750GB]? 1000GB&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Grow the filesystem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''resize2fs /dev/sdb1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
resize2fs: Device or resource busy while trying to open /dev/sdb1&lt;br /&gt;
Couldnt find valid filesystem superblock.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
woops, I specified the wrong device name.  I need to use the dev mapper name...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
Please run 'e2fsck -f /dev/mapper/vol1' first.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
whatever you say sir&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''e2fsck -f /dev/mapper/vol1'''&lt;br /&gt;
e2fsck 1.43.1 (08-Jun-2016)&lt;br /&gt;
Pass 1: Checking inodes, blocks, and sizes&lt;br /&gt;
Inode 18612229 extent tree (at level 2) could be narrower.  Fix&amp;lt;y&amp;gt;? yes&lt;br /&gt;
...&lt;br /&gt;
/dev/mapper/vol1: ***** FILE SYSTEM WAS MODIFIED *****&lt;br /&gt;
/dev/mapper/vol1: 352906/45793280 files (0.3% non-contiguous), 160544229/183142878 blocks&lt;br /&gt;
&lt;br /&gt;
localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
Resizing the filesystem on /dev/mapper/vol1 to 244139857 (4k) blocks.&lt;br /&gt;
The filesystem on /dev/mapper/vol1 is now 244139857 (4k) blocks long.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
[[category:disk]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition</id>
		<title>resize regular luks partition</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition"/>
				<updated>2025-08-02T15:15:38Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I replaced a 750GB drive with a 1TB.  I copied the old partitions over with dd.  The problem is that the partitions didn't make use of the extra space.  So, I needed to grow them.  There is nothing special about the luks it seems.  You just need to decrypt the drive and then proceed as if it was a regular file system.  I performed the following steps with it unmounted.  You can do it mounted.  I just chose not to.&lt;br /&gt;
&lt;br /&gt;
Grow the partition size.&lt;br /&gt;
&lt;br /&gt;
localhost ~ # '''parted /dev/sdb'''&lt;br /&gt;
GNU Parted 3.2&lt;br /&gt;
Using /dev/sdb&lt;br /&gt;
Welcome to GNU Parted! Type 'help' to view a list of commands.&lt;br /&gt;
(parted) resizepart 1                                                     &lt;br /&gt;
End?  [750GB]? 1000GB&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Grow the filesystem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''resize2fs /dev/sdb1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
resize2fs: Device or resource busy while trying to open /dev/sdb1&lt;br /&gt;
Couldnt find valid filesystem superblock.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
woops, I specified the wrong device name.  I need to use the dev mapper name...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
Please run 'e2fsck -f /dev/mapper/vol1' first.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
whatever you say sir&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''e2fsck -f /dev/mapper/vol1'''&lt;br /&gt;
e2fsck 1.43.1 (08-Jun-2016)&lt;br /&gt;
Pass 1: Checking inodes, blocks, and sizes&lt;br /&gt;
Inode 18612229 extent tree (at level 2) could be narrower.  Fix&amp;lt;y&amp;gt;? yes&lt;br /&gt;
...&lt;br /&gt;
/dev/mapper/vol1: ***** FILE SYSTEM WAS MODIFIED *****&lt;br /&gt;
/dev/mapper/vol1: 352906/45793280 files (0.3% non-contiguous), 160544229/183142878 blocks&lt;br /&gt;
&lt;br /&gt;
localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
Resizing the filesystem on /dev/mapper/vol1 to 244139857 (4k) blocks.&lt;br /&gt;
The filesystem on /dev/mapper/vol1 is now 244139857 (4k) blocks long.&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
[[category:disk]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition</id>
		<title>resize regular luks partition</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/resize_regular_luks_partition"/>
				<updated>2025-08-02T15:15:02Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I replaced a 750GB drive with a 1TB.  I copied the old partitions over with dd.  The problem is that the partitions didn't make use of the extra space.  So, I needed to grow them.  There is nothing special about the luks it seems.  You just need to decrypt the drive and then proceed as if it was a regular file system.  I performed the following steps with it unmounted.  You can do it mounted.  I just chose not to.&lt;br /&gt;
&lt;br /&gt;
Grow the partition size.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''parted /dev/sdb'''&lt;br /&gt;
GNU Parted 3.2&lt;br /&gt;
Using /dev/sdb&lt;br /&gt;
Welcome to GNU Parted! Type 'help' to view a list of commands.&lt;br /&gt;
(parted) resizepart 1                                                     &lt;br /&gt;
End?  [750GB]? 1000GB&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Grow the filesystem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''resize2fs /dev/sdb1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
resize2fs: Device or resource busy while trying to open /dev/sdb1&lt;br /&gt;
Couldnt find valid filesystem superblock.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
woops, I specified the wrong device name.  I need to use the dev mapper name...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
Please run 'e2fsck -f /dev/mapper/vol1' first.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
whatever you say sir&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
localhost ~ # '''e2fsck -f /dev/mapper/vol1'''&lt;br /&gt;
e2fsck 1.43.1 (08-Jun-2016)&lt;br /&gt;
Pass 1: Checking inodes, blocks, and sizes&lt;br /&gt;
Inode 18612229 extent tree (at level 2) could be narrower.  Fix&amp;lt;y&amp;gt;? yes&lt;br /&gt;
...&lt;br /&gt;
/dev/mapper/vol1: ***** FILE SYSTEM WAS MODIFIED *****&lt;br /&gt;
/dev/mapper/vol1: 352906/45793280 files (0.3% non-contiguous), 160544229/183142878 blocks&lt;br /&gt;
&lt;br /&gt;
localhost ~ # '''resize2fs /dev/mapper/vol1'''&lt;br /&gt;
resize2fs 1.43.1 (08-Jun-2016)&lt;br /&gt;
Resizing the filesystem on /dev/mapper/vol1 to 244139857 (4k) blocks.&lt;br /&gt;
The filesystem on /dev/mapper/vol1 is now 244139857 (4k) blocks long.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Done!&lt;br /&gt;
&lt;br /&gt;
[[category:disk]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/add_user_to_AD_group_via_powershell</id>
		<title>add user to AD group via powershell</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/add_user_to_AD_group_via_powershell"/>
				<updated>2025-07-30T19:44:16Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: Created page with &amp;quot; PS C:\Users\admin&amp;gt; Add-ADGroupMember -Identity &amp;quot;Domain Admins&amp;quot; -Members billy  category:winblows&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; PS C:\Users\admin&amp;gt; Add-ADGroupMember -Identity &amp;quot;Domain Admins&amp;quot; -Members billy&lt;br /&gt;
&lt;br /&gt;
[[category:winblows]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/show_connected_rdp_users_via_powershell</id>
		<title>show connected rdp users via powershell</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/show_connected_rdp_users_via_powershell"/>
				<updated>2025-07-30T19:42:42Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
 PS C:\Users\admin&amp;gt; '''query user'''&lt;br /&gt;
 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME&lt;br /&gt;
 bob                                       1  Disc           54  7/30/2025 11:29 AM&lt;br /&gt;
 chris                                     3  Disc            8  7/30/2025 12:06 PM&lt;br /&gt;
 joe                   rdp-tcp#28          4  Active          .  7/30/2025 1:37 PM&lt;br /&gt;
 bill                  rdp-tcp#37          5  Active          .  7/30/2025 2:24 PM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[category:winblows]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/show_connected_rdp_users_via_powershell</id>
		<title>show connected rdp users via powershell</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/show_connected_rdp_users_via_powershell"/>
				<updated>2025-07-30T19:41:58Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: Created page with &amp;quot; PS C:\Users\damon&amp;gt; '''query user'''  USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME  bob                                       1  Disc           5...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
PS C:\Users\damon&amp;gt; '''query user'''&lt;br /&gt;
 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME&lt;br /&gt;
 bob                                       1  Disc           54  7/30/2025 11:29 AM&lt;br /&gt;
 chris                                     3  Disc            8  7/30/2025 12:06 PM&lt;br /&gt;
 joe                   rdp-tcp#28          4  Active          .  7/30/2025 1:37 PM&lt;br /&gt;
 bill                  rdp-tcp#37          5  Active          .  7/30/2025 2:24 PM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[category:winblows]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/jq_json_parser_notes</id>
		<title>jq json parser notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/jq_json_parser_notes"/>
				<updated>2025-06-14T16:41:50Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==jq manual==&lt;br /&gt;
[https://stedolan.github.io/jq/manual/ jq Manual (development version)]&lt;br /&gt;
&lt;br /&gt;
select&lt;br /&gt;
&lt;br /&gt;
file...&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
 &amp;quot;json&amp;quot;: {&lt;br /&gt;
   &amp;quot;table&amp;quot;: [&lt;br /&gt;
     {&lt;br /&gt;
       &amp;quot;name&amp;quot;: &amp;quot;foo&amp;quot;,&lt;br /&gt;
       &amp;quot;color&amp;quot;: &amp;quot;green&amp;quot;&lt;br /&gt;
     },&lt;br /&gt;
     {&lt;br /&gt;
       &amp;quot;name&amp;quot;: &amp;quot;bar&amp;quot;,&lt;br /&gt;
       &amp;quot;color&amp;quot;: &amp;quot;blue&amp;quot;&lt;br /&gt;
     }&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 $ '''cat json.json | jq '.json.table[] | select (.name == &amp;quot;foo&amp;quot;)''''&lt;br /&gt;
 {&lt;br /&gt;
 &amp;quot;name&amp;quot;: &amp;quot;foo&amp;quot;,&lt;br /&gt;
 &amp;quot;color&amp;quot;: &amp;quot;green&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Regular expressions==&lt;br /&gt;
&lt;br /&gt;
 test(val), test(regex; flags)&lt;br /&gt;
Like match, but does not return match objects, only true or false for whether or not the regex matches the input&lt;br /&gt;
&lt;br /&gt;
example:&lt;br /&gt;
 '''$cat .tmp.json | jq '&amp;quot;HAHAHA 123&amp;quot; | test(&amp;quot;hahaha.*[0-9]{3}&amp;quot;; &amp;quot;i&amp;quot;)''''&lt;br /&gt;
 true&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/jq_json_parser_notes</id>
		<title>jq json parser notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/jq_json_parser_notes"/>
				<updated>2025-06-14T16:30:44Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==jq manual==&lt;br /&gt;
[https://stedolan.github.io/jq/manual/ jq Manual (development version)]&lt;br /&gt;
&lt;br /&gt;
select&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&amp;quot;json&amp;quot;: {&lt;br /&gt;
&amp;quot;table&amp;quot;: [&lt;br /&gt;
{&lt;br /&gt;
&amp;quot;name&amp;quot;: &amp;quot;foo&amp;quot;,&lt;br /&gt;
&amp;quot;color&amp;quot;: &amp;quot;green&amp;quot;&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
&amp;quot;name&amp;quot;: &amp;quot;bar&amp;quot;,&lt;br /&gt;
&amp;quot;color&amp;quot;: &amp;quot;blue&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
]&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 $ '''cat json.json | jq '.json.table[] | select (.name == &amp;quot;foo&amp;quot;)''''&lt;br /&gt;
 {&lt;br /&gt;
 &amp;quot;name&amp;quot;: &amp;quot;foo&amp;quot;,&lt;br /&gt;
 &amp;quot;color&amp;quot;: &amp;quot;green&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Regular expressions==&lt;br /&gt;
&lt;br /&gt;
 test(val), test(regex; flags)&lt;br /&gt;
Like match, but does not return match objects, only true or false for whether or not the regex matches the input&lt;br /&gt;
&lt;br /&gt;
example:&lt;br /&gt;
 '''$cat .tmp.json | jq '&amp;quot;HAHAHA 123&amp;quot; | test(&amp;quot;hahaha.*[0-9]{3}&amp;quot;; &amp;quot;i&amp;quot;)''''&lt;br /&gt;
 true&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/clear_windows_clipboard</id>
		<title>clear windows clipboard</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/clear_windows_clipboard"/>
				<updated>2025-06-07T15:27:36Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: Created page with &amp;quot; cmd /c echo off | clip  category:winblows&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; cmd /c echo off | clip&lt;br /&gt;
&lt;br /&gt;
[[category:winblows]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/linux_to_windows_powershell_over_ssh</id>
		<title>linux to windows powershell over ssh</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/linux_to_windows_powershell_over_ssh"/>
				<updated>2025-05-27T17:44:03Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==description==&lt;br /&gt;
Microsoft Windows [Version 10.0.18363.2274]&lt;br /&gt;
&lt;br /&gt;
==install openssh server on windows==&lt;br /&gt;
&lt;br /&gt;
from powershell on windows...&lt;br /&gt;
&lt;br /&gt;
check software status&lt;br /&gt;
 PS C:\WINDOWS\system32&amp;gt; '''Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*''''&lt;br /&gt;
&lt;br /&gt;
install openssh-server&lt;br /&gt;
 PS C:\WINDOWS\system32&amp;gt; Add-WindowsCapability -Online -Name OpenSSH.Server&lt;br /&gt;
 &amp;lt;br&amp;gt;Path          :&lt;br /&gt;
 Online        : True&lt;br /&gt;
 RestartNeeded : False&lt;br /&gt;
&lt;br /&gt;
at this point the software is installed but config files have NOT be created yet.&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/linux_to_windows_powershell_over_ssh</id>
		<title>linux to windows powershell over ssh</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/linux_to_windows_powershell_over_ssh"/>
				<updated>2025-05-27T17:43:34Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: Created page with &amp;quot;==description== Microsoft Windows [Version 10.0.18363.2274]  ==install openssh server on windows==  from powershell on windows...  check software status  PS C:\WINDOWS\system3...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==description==&lt;br /&gt;
Microsoft Windows [Version 10.0.18363.2274]&lt;br /&gt;
&lt;br /&gt;
==install openssh server on windows==&lt;br /&gt;
&lt;br /&gt;
from powershell on windows...&lt;br /&gt;
&lt;br /&gt;
check software status&lt;br /&gt;
 PS C:\WINDOWS\system32&amp;gt; '''Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*''''&lt;br /&gt;
&lt;br /&gt;
install openssh-server&lt;br /&gt;
 PS C:\WINDOWS\system32&amp;gt; Add-WindowsCapability -Online -Name OpenSSH.Server[[User:Nighthawk|Nighthawk]] ([[User talk:Nighthawk|talk]]) 17:43, 27 May 2025 (UTC)0.0.1.0&lt;br /&gt;
 &amp;lt;br&amp;gt;Path          :&lt;br /&gt;
 Online        : True&lt;br /&gt;
 RestartNeeded : False&lt;br /&gt;
&lt;br /&gt;
at this point the software is installed but config files have NOT be created yet.&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/yq_parser</id>
		<title>yq parser</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/yq_parser"/>
				<updated>2025-05-21T21:36:40Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;file name foobarr.yml contents:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
webserver:&lt;br /&gt;
  hosts:&lt;br /&gt;
    foo:&lt;br /&gt;
      ipaddr: 192.168.1.1&lt;br /&gt;
      desc: &amp;quot;foo&amp;quot;&lt;br /&gt;
    bar:&lt;br /&gt;
      ipaddr: 10.0.0.1&lt;br /&gt;
      desc: &amp;quot;bar&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 $ '''yq '.webserver.hosts[] | select(.ipaddr == &amp;quot;192.168.1.1&amp;quot;)'  foobar.yml'''&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;ipaddr&amp;quot;: &amp;quot;192.168.1.1&amp;quot;&lt;br /&gt;
 }yq '.webserver.hosts[] | select(.ipaddr == &amp;quot;192.168.1.1&amp;quot;)'  foobar.yml&lt;br /&gt;
&lt;br /&gt;
pass an arg&lt;br /&gt;
&lt;br /&gt;
 $ '''yq --arg IPADDR &amp;quot;$ipaddr&amp;quot; '.webserver.hosts[] | select(.ipaddr == &amp;quot;192.168.1.1&amp;quot;)' foobar.yml'''&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/yq_parser</id>
		<title>yq parser</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/yq_parser"/>
				<updated>2025-05-21T21:36:02Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;file name foobarr.yml contents:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
webserver:&lt;br /&gt;
  hosts:&lt;br /&gt;
    foo:&lt;br /&gt;
      ipaddr: 192.168.1.1&lt;br /&gt;
      desc: &amp;quot;foo&amp;quot;&lt;br /&gt;
    bar:&lt;br /&gt;
      ipaddr: 10.0.0.1&lt;br /&gt;
      desc: &amp;quot;bar&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 $ '''yq '.webserver.hosts[] | select(.ipaddr == &amp;quot;192.168.1.1&amp;quot;)'  foobar.yml'''&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;ipaddr&amp;quot;: &amp;quot;192.168.1.1&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
pass an arg&lt;br /&gt;
&lt;br /&gt;
 $ '''yq --arg IPADDR &amp;quot;$ipaddr&amp;quot; '.webserver.hosts[] | select(.ipaddr == &amp;quot;192.168.1.1&amp;quot;)' foobar.yml'''&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/yq_parser</id>
		<title>yq parser</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/yq_parser"/>
				<updated>2025-05-21T21:35:02Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;file name devices_test.yml contents:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
webserver:&lt;br /&gt;
  hosts:&lt;br /&gt;
    foo:&lt;br /&gt;
      ipaddr: 192.168.1.1&lt;br /&gt;
      desc: &amp;quot;foo&amp;quot;&lt;br /&gt;
    bar:&lt;br /&gt;
      ipaddr: 10.0.0.1&lt;br /&gt;
      desc: &amp;quot;bar&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 $ '''yq '.webserver.hosts[] | select(.ipaddr == &amp;quot;192.168.1.1&amp;quot;)' devices_test.yml'''&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;ipaddr&amp;quot;: &amp;quot;192.168.1.1&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
pass an arg&lt;br /&gt;
&lt;br /&gt;
 $ '''yq --arg IPADDR &amp;quot;$ipaddr&amp;quot; '.webserver.hosts[] | select(.ipaddr == &amp;quot;192.168.1.1&amp;quot;)' devices_test.yml'''&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/setting_wine_prefix_at_CLI</id>
		<title>setting wine prefix at CLI</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/setting_wine_prefix_at_CLI"/>
				<updated>2025-05-13T18:50:47Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: Created page with &amp;quot;To specify a WINEPREFIX on the command line when running Wine, set the WINEPREFIX environment variable before the command. For example:  bash   WINEPREFIX=/path/to/your/prefix...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To specify a WINEPREFIX on the command line when running Wine, set the WINEPREFIX environment variable before the command. For example:&lt;br /&gt;
&lt;br /&gt;
bash&lt;br /&gt;
&lt;br /&gt;
 WINEPREFIX=/path/to/your/prefix wine your_program.exe&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/rdesktop_and_function_keys</id>
		<title>rdesktop and function keys</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/rdesktop_and_function_keys"/>
				<updated>2025-05-13T18:48:24Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: Created page with &amp;quot;goal: to prevent the linux windows manager function key bindings from being the victim of override  solution:   -K     Do not override window manager key bindings.  By default...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;goal: to prevent the linux windows manager function key bindings from being the victim of override&lt;br /&gt;
&lt;br /&gt;
solution: &lt;br /&gt;
 -K     Do not override window manager key bindings.  By default rdesktop &lt;br /&gt;
       attempts to grab all keyboard input when it is in focus.&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/Keyboard_automation</id>
		<title>Keyboard automation</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/Keyboard_automation"/>
				<updated>2025-04-24T17:23:48Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* common key codes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==environment==&lt;br /&gt;
o.s. = debian stretch (this will work with any linux)&lt;br /&gt;
&amp;lt;br&amp;gt;xserver = xserver-xorg-core 2:1.19.2-1+deb9u5&lt;br /&gt;
&amp;lt;br&amp;gt;xdotool = 1:3.20160805.1-3&lt;br /&gt;
&lt;br /&gt;
==problem==&lt;br /&gt;
need to program keyboard keys (macros) to send keyboard input or launch programs&lt;br /&gt;
&lt;br /&gt;
==solution==&lt;br /&gt;
install xdotool and configure&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;snooping&amp;quot; keyboard input keycodes===&lt;br /&gt;
&lt;br /&gt;
in a terminal run program '''xev''' (comes with xserver-xorg-core i think) and then just hit the keyboard key of interest. you will see output such as...&lt;br /&gt;
&lt;br /&gt;
 KeyPress event, serial 37, synthetic NO, window 0x3600001,&lt;br /&gt;
    root 0x4a0, subw 0x0, time 9652301, (164,120), root:(2235,492),&lt;br /&gt;
    '''state 0x10, keycode 133''' (keysym 0xffeb, Super_L), same_screen YES,&lt;br /&gt;
    XLookupString gives 0 bytes: &lt;br /&gt;
    XmbLookupString gives 0 bytes: &lt;br /&gt;
    XFilterEvent returns: False&lt;br /&gt;
&lt;br /&gt;
make a note of the state and keycode which are to be input into the xdotool config&lt;br /&gt;
&lt;br /&gt;
===example keyboard input===&lt;br /&gt;
&lt;br /&gt;
here we will program the &amp;quot;windows&amp;quot; key (between left ctrl and alt) to send &amp;quot;hahah lol&amp;quot; text as if entered by the keyboard.&lt;br /&gt;
&lt;br /&gt;
edit $HOME/.xbindkeysrc, add a section like the one below. first line is a comment, 2nd is the commands to execute, 3rd line is the keycode line where 0x10 is from the state above and 133 is the keycode.&lt;br /&gt;
&lt;br /&gt;
 ## &amp;quot;windows&amp;quot; key macro&lt;br /&gt;
 &amp;quot;sleep 0.2 &amp;amp;&amp;amp; xdotool type --delay 15 'hahaha lol';&amp;quot;&lt;br /&gt;
    m:0x10 + c:133&lt;br /&gt;
&lt;br /&gt;
save .xbindkeysrc&lt;br /&gt;
&lt;br /&gt;
start or restart xbindkeys&lt;br /&gt;
&lt;br /&gt;
 $ killall xbindkeys; xbindkeys&lt;br /&gt;
&lt;br /&gt;
in a terminal or text editor test you keyboard input by pressing you &amp;quot;windows key&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 it should output...&lt;br /&gt;
 &lt;br /&gt;
 hahaha lol&lt;br /&gt;
&lt;br /&gt;
===example keyboard input===&lt;br /&gt;
&lt;br /&gt;
same steps as above, add the following section to $HOME/.xbindkeys (did this after installing screengrab). my printscreen keycode was 107, yours may be different.&lt;br /&gt;
&lt;br /&gt;
 ## printscreen keyboard shortcut&lt;br /&gt;
 &amp;quot;/usr/bin/screengrab&amp;quot;&lt;br /&gt;
    m:0x10 + c:107&lt;br /&gt;
&lt;br /&gt;
start or restart xbindkeys&lt;br /&gt;
&lt;br /&gt;
test by hitting you printscreen button, hope it works!&lt;br /&gt;
&lt;br /&gt;
===common key codes===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; KP_Space, KP_Enter, KP_Tab, KP_F1, KP_Up, KP_Right, Shift_L&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; key 1, key a&lt;br /&gt;
&lt;br /&gt;
send a string&lt;br /&gt;
&lt;br /&gt;
 xdotool type --delay 15 'abc123'&lt;br /&gt;
&lt;br /&gt;
where delay is in ms between simulated key strokes&lt;br /&gt;
&lt;br /&gt;
mouse clicks&lt;br /&gt;
&lt;br /&gt;
 xdotool click 1, xdotool click 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[category:linux]]&lt;br /&gt;
[[category:automation]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/Keyboard_automation</id>
		<title>Keyboard automation</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/Keyboard_automation"/>
				<updated>2025-04-24T17:22:42Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==environment==&lt;br /&gt;
o.s. = debian stretch (this will work with any linux)&lt;br /&gt;
&amp;lt;br&amp;gt;xserver = xserver-xorg-core 2:1.19.2-1+deb9u5&lt;br /&gt;
&amp;lt;br&amp;gt;xdotool = 1:3.20160805.1-3&lt;br /&gt;
&lt;br /&gt;
==problem==&lt;br /&gt;
need to program keyboard keys (macros) to send keyboard input or launch programs&lt;br /&gt;
&lt;br /&gt;
==solution==&lt;br /&gt;
install xdotool and configure&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;snooping&amp;quot; keyboard input keycodes===&lt;br /&gt;
&lt;br /&gt;
in a terminal run program '''xev''' (comes with xserver-xorg-core i think) and then just hit the keyboard key of interest. you will see output such as...&lt;br /&gt;
&lt;br /&gt;
 KeyPress event, serial 37, synthetic NO, window 0x3600001,&lt;br /&gt;
    root 0x4a0, subw 0x0, time 9652301, (164,120), root:(2235,492),&lt;br /&gt;
    '''state 0x10, keycode 133''' (keysym 0xffeb, Super_L), same_screen YES,&lt;br /&gt;
    XLookupString gives 0 bytes: &lt;br /&gt;
    XmbLookupString gives 0 bytes: &lt;br /&gt;
    XFilterEvent returns: False&lt;br /&gt;
&lt;br /&gt;
make a note of the state and keycode which are to be input into the xdotool config&lt;br /&gt;
&lt;br /&gt;
===example keyboard input===&lt;br /&gt;
&lt;br /&gt;
here we will program the &amp;quot;windows&amp;quot; key (between left ctrl and alt) to send &amp;quot;hahah lol&amp;quot; text as if entered by the keyboard.&lt;br /&gt;
&lt;br /&gt;
edit $HOME/.xbindkeysrc, add a section like the one below. first line is a comment, 2nd is the commands to execute, 3rd line is the keycode line where 0x10 is from the state above and 133 is the keycode.&lt;br /&gt;
&lt;br /&gt;
 ## &amp;quot;windows&amp;quot; key macro&lt;br /&gt;
 &amp;quot;sleep 0.2 &amp;amp;&amp;amp; xdotool type --delay 15 'hahaha lol';&amp;quot;&lt;br /&gt;
    m:0x10 + c:133&lt;br /&gt;
&lt;br /&gt;
save .xbindkeysrc&lt;br /&gt;
&lt;br /&gt;
start or restart xbindkeys&lt;br /&gt;
&lt;br /&gt;
 $ killall xbindkeys; xbindkeys&lt;br /&gt;
&lt;br /&gt;
in a terminal or text editor test you keyboard input by pressing you &amp;quot;windows key&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 it should output...&lt;br /&gt;
 &lt;br /&gt;
 hahaha lol&lt;br /&gt;
&lt;br /&gt;
===example keyboard input===&lt;br /&gt;
&lt;br /&gt;
same steps as above, add the following section to $HOME/.xbindkeys (did this after installing screengrab). my printscreen keycode was 107, yours may be different.&lt;br /&gt;
&lt;br /&gt;
 ## printscreen keyboard shortcut&lt;br /&gt;
 &amp;quot;/usr/bin/screengrab&amp;quot;&lt;br /&gt;
    m:0x10 + c:107&lt;br /&gt;
&lt;br /&gt;
start or restart xbindkeys&lt;br /&gt;
&lt;br /&gt;
test by hitting you printscreen button, hope it works!&lt;br /&gt;
&lt;br /&gt;
===common key codes===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; KP_Space, KP_Enter, KP_Tab, KP_F1, KP_Up, KP_Right, Shift_L&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; key 1, key a&lt;br /&gt;
&lt;br /&gt;
send a string&lt;br /&gt;
&lt;br /&gt;
xdotool type --delay 15 'abc123'&lt;br /&gt;
&lt;br /&gt;
where delay is in ms between simulated key strokes&lt;br /&gt;
&lt;br /&gt;
mouse clicks&lt;br /&gt;
&lt;br /&gt;
 xdotool click 1, xdotool click 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[category:linux]]&lt;br /&gt;
[[category:automation]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T22:12:06Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
A variable name can only include letters, numbers, and underscores. [https://docs.python.org/3/reference/lexical_analysis.html#keywords Python keywords]  or [https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#playbook-keywords playbook keywords] are not valid variable names. A variable name cannot begin with a number. Use use double curly braces to reference them. i.e.&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ foo }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
Simple vars store a single value. &lt;br /&gt;
&lt;br /&gt;
List variables store multiple.&lt;br /&gt;
&lt;br /&gt;
referencing specific fields&lt;br /&gt;
 region: &amp;quot;{{ region[0] }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Dictionary vars store data in key-value pairs&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Combining list variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
   merged_list: &amp;lt;nowiki&amp;gt;&amp;quot;{{ list1 + list2 }}&amp;quot;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Combining dictionary variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
  merged_dict: &amp;lt;nowiki&amp;gt;&amp;quot;{{ dict1 | ansible.builtin.combine(dict2) }}&amp;quot;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
merge variables that match the given prefixes, suffixes, or regular expressions, you can use the community.general.merge_variables lookup, for example:&lt;br /&gt;
&lt;br /&gt;
 merged_variable: &amp;lt;nowiki&amp;gt;&amp;quot;{{ lookup('community.general.merge_variables', '__my_pattern', pattern_type='suffix') }}&amp;quot;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
Reference nested variables using either bracket notation or dot notation&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 '{{ ansible_facts[&amp;quot;eth0&amp;quot;][&amp;quot;ipv4&amp;quot;][&amp;quot;address&amp;quot;] }}'&lt;br /&gt;
 or&lt;br /&gt;
 {{ ansible_facts.eth0.ipv4.address }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
Variables can be set via files (like inventory), plays or command line at run time.&lt;br /&gt;
&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Registering variables with the task keyword register.&lt;br /&gt;
&lt;br /&gt;
     - name: Run a shell command and register its output as a variable&lt;br /&gt;
       ansible.builtin.shell: /usr/bin/foo&lt;br /&gt;
       register: foo_result&lt;br /&gt;
&lt;br /&gt;
Defining variables at runtime&lt;br /&gt;
&lt;br /&gt;
key=value syntax&lt;br /&gt;
values are interpreted as strings &lt;br /&gt;
&lt;br /&gt;
 ansible-playbook release.yml --extra-vars &amp;quot;version=1.23.45 other_variable=foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use the JSON format if you need to pass non-string values such as Booleans, integers, floats, lists...&lt;br /&gt;
&lt;br /&gt;
 ansible-playbook release.yml --extra-vars '{&amp;quot;version&amp;quot;:&amp;quot;1.23.45&amp;quot;,&amp;quot;other_variable&amp;quot;:&amp;quot;foo&amp;quot;}'&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars '{&amp;quot;pacman&amp;quot;:&amp;quot;mrs&amp;quot;,&amp;quot;ghosts&amp;quot;:[&amp;quot;inky&amp;quot;,&amp;quot;pinky&amp;quot;,&amp;quot;clyde&amp;quot;,&amp;quot;sue&amp;quot;]}'&lt;br /&gt;
&lt;br /&gt;
you must escape quotes and other special characters &lt;br /&gt;
&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars &amp;quot;{\&amp;quot;name\&amp;quot;:\&amp;quot;Conan O\'Brien\&amp;quot;}&amp;quot;&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars '{&amp;quot;name&amp;quot;:&amp;quot;Conan O'\\\''Brien&amp;quot;}'&lt;br /&gt;
 ansible-playbook script.yml --extra-vars &amp;quot;{\&amp;quot;dialog\&amp;quot;:\&amp;quot;He said \\\&amp;quot;I just can\'t get enough of those single and double-quotes&amp;quot;\!&amp;quot;\\\&amp;quot;\&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T21:53:44Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* Adding variables to inventory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
A variable name can only include letters, numbers, and underscores. [https://docs.python.org/3/reference/lexical_analysis.html#keywords Python keywords]  or [https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#playbook-keywords playbook keywords] are not valid variable names. A variable name cannot begin with a number. Use use double curly braces to reference them. i.e.&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ foo }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
Simple vars store a single value. &lt;br /&gt;
&lt;br /&gt;
List variables store multiple.&lt;br /&gt;
&lt;br /&gt;
referencing specific fields&lt;br /&gt;
 region: &amp;quot;{{ region[0] }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Dictionary vars store data in key-value pairs&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Combining list variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
   merged_list: &amp;quot;{{ list1 + list2 }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Combining dictionary variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
  merged_dict: &amp;quot;{{ dict1 | ansible.builtin.combine(dict2) }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
merge variables that match the given prefixes, suffixes, or regular expressions, you can use the community.general.merge_variables lookup, for example:&lt;br /&gt;
&lt;br /&gt;
 merged_variable: &amp;quot;{{ lookup('community.general.merge_variables', '__my_pattern', pattern_type='suffix') }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
Reference nested variables using either bracket notation or dot notation&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 '{{ ansible_facts[&amp;quot;eth0&amp;quot;][&amp;quot;ipv4&amp;quot;][&amp;quot;address&amp;quot;] }}'&lt;br /&gt;
 or&lt;br /&gt;
 {{ ansible_facts.eth0.ipv4.address }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
Variables can be set via files (like inventory), plays or command line at run time.&lt;br /&gt;
&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Registering variables with the task keyword register.&lt;br /&gt;
&lt;br /&gt;
     - name: Run a shell command and register its output as a variable&lt;br /&gt;
       ansible.builtin.shell: /usr/bin/foo&lt;br /&gt;
       register: foo_result&lt;br /&gt;
&lt;br /&gt;
Defining variables at runtime&lt;br /&gt;
&lt;br /&gt;
key=value syntax&lt;br /&gt;
values are interpreted as strings &lt;br /&gt;
&lt;br /&gt;
 ansible-playbook release.yml --extra-vars &amp;quot;version=1.23.45 other_variable=foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use the JSON format if you need to pass non-string values such as Booleans, integers, floats, lists...&lt;br /&gt;
&lt;br /&gt;
 ansible-playbook release.yml --extra-vars '{&amp;quot;version&amp;quot;:&amp;quot;1.23.45&amp;quot;,&amp;quot;other_variable&amp;quot;:&amp;quot;foo&amp;quot;}'&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars '{&amp;quot;pacman&amp;quot;:&amp;quot;mrs&amp;quot;,&amp;quot;ghosts&amp;quot;:[&amp;quot;inky&amp;quot;,&amp;quot;pinky&amp;quot;,&amp;quot;clyde&amp;quot;,&amp;quot;sue&amp;quot;]}'&lt;br /&gt;
&lt;br /&gt;
you must escape quotes and other special characters &lt;br /&gt;
&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars &amp;quot;{\&amp;quot;name\&amp;quot;:\&amp;quot;Conan O\'Brien\&amp;quot;}&amp;quot;&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars '{&amp;quot;name&amp;quot;:&amp;quot;Conan O'\\\''Brien&amp;quot;}'&lt;br /&gt;
 ansible-playbook script.yml --extra-vars &amp;quot;{\&amp;quot;dialog\&amp;quot;:\&amp;quot;He said \\\&amp;quot;I just can\'t get enough of those single and double-quotes&amp;quot;\!&amp;quot;\\\&amp;quot;\&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_loop_fail</id>
		<title>ansible loop fail</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_loop_fail"/>
				<updated>2025-04-16T21:35:46Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* Example Play */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Problem: loops were failing when trying to pass a variable with something like &amp;quot;foo,bar&amp;quot; in it. This is just a string with a comma in it.&lt;br /&gt;
&lt;br /&gt;
ansible error: Invalid data passed to 'loop', it requires a list&lt;br /&gt;
&lt;br /&gt;
Solution: enscapsulate with square brackets [ ] and quotes around individual elements.&lt;br /&gt;
&lt;br /&gt;
example:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;foo&amp;quot;,&amp;quot;bar&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example Play ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
 - name: example play showing common loop/list error&lt;br /&gt;
 hosts: localhost&lt;br /&gt;
 gather_facts: false&lt;br /&gt;
 tasks:&lt;br /&gt;
   - name: set var1&lt;br /&gt;
     set_fact:&lt;br /&gt;
     var1: &amp;quot;foo,bar&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
   - name: set var2&lt;br /&gt;
     set_fact:&lt;br /&gt;
     var2: [&amp;quot;foo&amp;quot;,&amp;quot;bar&amp;quot;]&lt;br /&gt;
   &lt;br /&gt;
   - name: output var1 type&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ var1 | type_debug }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: output var2 type&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ var2 | type_debug }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: try to loop var2&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ item }}&amp;quot;&lt;br /&gt;
     loop: &amp;quot;{{ var2 }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: try to loop var1&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ item }}&amp;quot;&lt;br /&gt;
     loop: &amp;quot;{{ var1 }}&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$ '''ansible-playbook example_list.yml'''&lt;br /&gt;
 &amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
 PLAY [localhost] &lt;br /&gt;
 *******************************************************************************************************      &lt;br /&gt;
 &lt;br /&gt;
 TASK [set var1] &lt;br /&gt;
 *******************************************************************************************************&lt;br /&gt;
 ok: [localhost]&lt;br /&gt;
 &lt;br /&gt;
 TASK [set var2] &lt;br /&gt;
 ********************************************************************************************************&lt;br /&gt;
 ok: [localhost]&lt;br /&gt;
 &lt;br /&gt;
 TASK [output var1 type] &lt;br /&gt;
 ************************************************************************************************&lt;br /&gt;
 ok: [localhost] =&amp;gt; {&lt;br /&gt;
 &amp;quot;msg&amp;quot;: &amp;quot;AnsibleUnicode&amp;quot;&lt;br /&gt;
 } &lt;br /&gt;
 &lt;br /&gt;
 TASK [output var2 type] &lt;br /&gt;
 ************************************************************************************************&lt;br /&gt;
 ok: [localhost] =&amp;gt; {&lt;br /&gt;
 &amp;quot;msg&amp;quot;: &amp;quot;list&amp;quot;&lt;br /&gt;
 } &lt;br /&gt;
 &lt;br /&gt;
 TASK [try to loop var2] &lt;br /&gt;
 ************************************************************************************************&lt;br /&gt;
 ok: [localhost] =&amp;gt; (item=foo) =&amp;gt; {&lt;br /&gt;
 &amp;quot;msg&amp;quot;: &amp;quot;foo&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 ok: [localhost] =&amp;gt; (item=bar) =&amp;gt; {&lt;br /&gt;
 &amp;quot;msg&amp;quot;: &amp;quot;bar&amp;quot;&lt;br /&gt;
 } &lt;br /&gt;
 &lt;br /&gt;
 TASK [try to loop var1] &lt;br /&gt;
 ************************************************************************************************&lt;br /&gt;
 fatal: [localhost]: FAILED! =&amp;gt; {&amp;quot;msg&amp;quot;: &amp;quot;Invalid data passed to 'loop', it requires a list, got this &lt;br /&gt;
 instead: foo,bar. Hint: If you passed a list/dict of just one element, try adding wantlist=True to your &lt;br /&gt;
 lookup invocation or use q/query instead of lookup.&amp;quot;}&lt;br /&gt;
 &lt;br /&gt;
 PLAY RECAP &lt;br /&gt;
 *************************************************************************************************************&lt;br /&gt;
 localhost                  : ok=5    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    &lt;br /&gt;
 ignored=0 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_loop_fail</id>
		<title>ansible loop fail</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_loop_fail"/>
				<updated>2025-04-16T21:34:25Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Problem: loops were failing when trying to pass a variable with something like &amp;quot;foo,bar&amp;quot; in it. This is just a string with a comma in it.&lt;br /&gt;
&lt;br /&gt;
ansible error: Invalid data passed to 'loop', it requires a list&lt;br /&gt;
&lt;br /&gt;
Solution: enscapsulate with square brackets [ ] and quotes around individual elements.&lt;br /&gt;
&lt;br /&gt;
example:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;foo&amp;quot;,&amp;quot;bar&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example Play ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
 - name: example play showing common loop/list error&lt;br /&gt;
 hosts: localhost&lt;br /&gt;
 gather_facts: false&lt;br /&gt;
 tasks:&lt;br /&gt;
   - name: set var1&lt;br /&gt;
     set_fact:&lt;br /&gt;
     var1: &amp;quot;foo,bar&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
   - name: set var2&lt;br /&gt;
     set_fact:&lt;br /&gt;
     var2: [&amp;quot;foo&amp;quot;,&amp;quot;bar&amp;quot;]&lt;br /&gt;
   &lt;br /&gt;
   - name: output var1 type&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ var1 | type_debug }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: output var2 type&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ var2 | type_debug }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: try to loop var2&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ item }}&amp;quot;&lt;br /&gt;
     loop: &amp;quot;{{ var2 }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: try to loop var1&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ item }}&amp;quot;&lt;br /&gt;
     loop: &amp;quot;{{ var1 }}&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook example_list.yml'''&lt;br /&gt;
 &amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
 PLAY [localhost] &lt;br /&gt;
 *******************************************************************************************************      &lt;br /&gt;
 &lt;br /&gt;
 TASK [set var1] &lt;br /&gt;
 *******************************************************************************************************&lt;br /&gt;
 ok: [localhost]&lt;br /&gt;
 &lt;br /&gt;
 TASK [set var2] &lt;br /&gt;
 ********************************************************************************************************&lt;br /&gt;
 ok: [localhost]&lt;br /&gt;
 &lt;br /&gt;
 TASK [output var1 type] &lt;br /&gt;
 ************************************************************************************************&lt;br /&gt;
 ok: [localhost] =&amp;gt; {&lt;br /&gt;
 &amp;quot;msg&amp;quot;: &amp;quot;AnsibleUnicode&amp;quot;&lt;br /&gt;
 } &lt;br /&gt;
 &lt;br /&gt;
 TASK [output var2 type] &lt;br /&gt;
 ************************************************************************************************&lt;br /&gt;
 ok: [localhost] =&amp;gt; {&lt;br /&gt;
 &amp;quot;msg&amp;quot;: &amp;quot;list&amp;quot;&lt;br /&gt;
 } &lt;br /&gt;
 &lt;br /&gt;
 TASK [try to loop var2] &lt;br /&gt;
 ************************************************************************************************&lt;br /&gt;
 ok: [localhost] =&amp;gt; (item=foo) =&amp;gt; {&lt;br /&gt;
 &amp;quot;msg&amp;quot;: &amp;quot;foo&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 ok: [localhost] =&amp;gt; (item=bar) =&amp;gt; {&lt;br /&gt;
 &amp;quot;msg&amp;quot;: &amp;quot;bar&amp;quot;&lt;br /&gt;
 } &lt;br /&gt;
 &lt;br /&gt;
 TASK [try to loop var1] &lt;br /&gt;
 ************************************************************************************************&lt;br /&gt;
 fatal: [localhost]: FAILED! =&amp;gt; {&amp;quot;msg&amp;quot;: &amp;quot;Invalid data passed to 'loop', it requires a list, got this &lt;br /&gt;
 instead: foo,bar. Hint: If you passed a list/dict of just one element, try adding wantlist=True to your &lt;br /&gt;
 lookup invocation or use q/query instead of lookup.&amp;quot;}&lt;br /&gt;
 &lt;br /&gt;
 PLAY RECAP &lt;br /&gt;
 *************************************************************************************************************&lt;br /&gt;
 localhost                  : ok=5    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    &lt;br /&gt;
 ignored=0 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_loop_fail</id>
		<title>ansible loop fail</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_loop_fail"/>
				<updated>2025-04-16T21:31:03Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* Example Play */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Problem: loops were failing when trying to pass a variable with something like &amp;quot;foo,bar&amp;quot; in it. This is just a string with a comma in it.&lt;br /&gt;
&lt;br /&gt;
ansible error: Invalid data passed to 'loop', it requires a list&lt;br /&gt;
&lt;br /&gt;
Solution: enscapsulate with square brackets [ ] and quotes around individual elements.&lt;br /&gt;
&lt;br /&gt;
example:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;foo&amp;quot;,&amp;quot;bar&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example Play ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
 - name: example play showing common loop/list error&lt;br /&gt;
 hosts: localhost&lt;br /&gt;
 gather_facts: false&lt;br /&gt;
 tasks:&lt;br /&gt;
   - name: set var1&lt;br /&gt;
     set_fact:&lt;br /&gt;
     var1: &amp;quot;foo,bar&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
   - name: set var2&lt;br /&gt;
     set_fact:&lt;br /&gt;
     var2: [&amp;quot;foo&amp;quot;,&amp;quot;bar&amp;quot;]&lt;br /&gt;
   &lt;br /&gt;
   - name: output var1 type&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ var1 | type_debug }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: output var2 type&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ var2 | type_debug }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: try to loop var2&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ item }}&amp;quot;&lt;br /&gt;
     loop: &amp;quot;{{ var2 }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: try to loop var1&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ item }}&amp;quot;&lt;br /&gt;
     loop: &amp;quot;{{ var1 }}&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$ '''ansible-playbook example_list.yml'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
PLAY [localhost] *******************************************************************************************************&lt;br /&gt;
&lt;br /&gt;
TASK [set var1] ********************************************************************************************************&lt;br /&gt;
ok: [localhost]&lt;br /&gt;
&lt;br /&gt;
TASK [set var2] ********************************************************************************************************&lt;br /&gt;
ok: [localhost]&lt;br /&gt;
&lt;br /&gt;
TASK [output var1 type] ************************************************************************************************&lt;br /&gt;
ok: [localhost] =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;AnsibleUnicode&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TASK [output var2 type] ************************************************************************************************&lt;br /&gt;
ok: [localhost] =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;list&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TASK [try to loop var2] ************************************************************************************************&lt;br /&gt;
ok: [localhost] =&amp;gt; (item=foo) =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;foo&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
ok: [localhost] =&amp;gt; (item=bar) =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;bar&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TASK [try to loop var1] ************************************************************************************************&lt;br /&gt;
fatal: [localhost]: FAILED! =&amp;gt; {&amp;quot;msg&amp;quot;: &amp;quot;Invalid data passed to 'loop', it requires a list, got this instead: foo,bar. Hint: If you passed a list/dict of just one element, try adding wantlist=True to your lookup invocation or use q/query instead of lookup.&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
PLAY RECAP *************************************************************************************************************&lt;br /&gt;
localhost                  : ok=5    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_loop_fail</id>
		<title>ansible loop fail</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_loop_fail"/>
				<updated>2025-04-16T21:29:57Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Problem: loops were failing when trying to pass a variable with something like &amp;quot;foo,bar&amp;quot; in it. This is just a string with a comma in it.&lt;br /&gt;
&lt;br /&gt;
ansible error: Invalid data passed to 'loop', it requires a list&lt;br /&gt;
&lt;br /&gt;
Solution: enscapsulate with square brackets [ ] and quotes around individual elements.&lt;br /&gt;
&lt;br /&gt;
example:&lt;br /&gt;
&lt;br /&gt;
 [&amp;quot;foo&amp;quot;,&amp;quot;bar&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example Play ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
 - name: example play showing common loop/list error&lt;br /&gt;
 hosts: localhost&lt;br /&gt;
 gather_facts: false&lt;br /&gt;
 tasks:&lt;br /&gt;
   - name: set var1&lt;br /&gt;
     set_fact:&lt;br /&gt;
     var1: &amp;quot;foo,bar&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
   - name: set var2&lt;br /&gt;
     set_fact:&lt;br /&gt;
     var2: [&amp;quot;foo&amp;quot;,&amp;quot;bar&amp;quot;]&lt;br /&gt;
   &lt;br /&gt;
   - name: output var1 type&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ var1 | type_debug }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: output var2 type&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ var2 | type_debug }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: try to loop var2&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ item }}&amp;quot;&lt;br /&gt;
     loop: &amp;quot;{{ var2 }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: try to loop var1&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ item }}&amp;quot;&lt;br /&gt;
     loop: &amp;quot;{{ var1 }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$ '''ansible-playbook example_list.yml'''&lt;br /&gt;
&lt;br /&gt;
PLAY [localhost] *******************************************************************************************************&lt;br /&gt;
&lt;br /&gt;
TASK [set var1] ********************************************************************************************************&lt;br /&gt;
ok: [localhost]&lt;br /&gt;
&lt;br /&gt;
TASK [set var2] ********************************************************************************************************&lt;br /&gt;
ok: [localhost]&lt;br /&gt;
&lt;br /&gt;
TASK [output var1 type] ************************************************************************************************&lt;br /&gt;
ok: [localhost] =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;AnsibleUnicode&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TASK [output var2 type] ************************************************************************************************&lt;br /&gt;
ok: [localhost] =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;list&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TASK [try to loop var2] ************************************************************************************************&lt;br /&gt;
ok: [localhost] =&amp;gt; (item=foo) =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;foo&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
ok: [localhost] =&amp;gt; (item=bar) =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;bar&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TASK [try to loop var1] ************************************************************************************************&lt;br /&gt;
fatal: [localhost]: FAILED! =&amp;gt; {&amp;quot;msg&amp;quot;: &amp;quot;Invalid data passed to 'loop', it requires a list, got this instead: foo,bar. Hint: If you passed a list/dict of just one element, try adding wantlist=True to your lookup invocation or use q/query instead of lookup.&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
PLAY RECAP *************************************************************************************************************&lt;br /&gt;
localhost                  : ok=5    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_loop_fail</id>
		<title>ansible loop fail</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_loop_fail"/>
				<updated>2025-04-16T21:24:38Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: Created page with &amp;quot;  &amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;  - name: example play showing common loop/list error  hosts: localhost  gather_facts: false  tasks:    - name: set var1      set_fact:      var1: &amp;quot;foo,b...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
 - name: example play showing common loop/list error&lt;br /&gt;
 hosts: localhost&lt;br /&gt;
 gather_facts: false&lt;br /&gt;
 tasks:&lt;br /&gt;
   - name: set var1&lt;br /&gt;
     set_fact:&lt;br /&gt;
     var1: &amp;quot;foo,bar&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
   - name: set var2&lt;br /&gt;
     set_fact:&lt;br /&gt;
     var2: [&amp;quot;foo&amp;quot;,&amp;quot;bar&amp;quot;]&lt;br /&gt;
   &lt;br /&gt;
   - name: output var1 type&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ var1 | type_debug }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: output var2 type&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ var2 | type_debug }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: try to loop var2&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ item }}&amp;quot;&lt;br /&gt;
     loop: &amp;quot;{{ var2 }}&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
   - name: try to loop var1&lt;br /&gt;
     debug:&lt;br /&gt;
     msg: &amp;quot;{{ item }}&amp;quot;&lt;br /&gt;
     loop: &amp;quot;{{ var1 }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$ ansible-playbook example_list.yml&lt;br /&gt;
&lt;br /&gt;
PLAY [localhost] *******************************************************************************************************&lt;br /&gt;
&lt;br /&gt;
TASK [set var1] ********************************************************************************************************&lt;br /&gt;
ok: [localhost]&lt;br /&gt;
&lt;br /&gt;
TASK [set var2] ********************************************************************************************************&lt;br /&gt;
ok: [localhost]&lt;br /&gt;
&lt;br /&gt;
TASK [output var1 type] ************************************************************************************************&lt;br /&gt;
ok: [localhost] =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;AnsibleUnicode&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TASK [output var2 type] ************************************************************************************************&lt;br /&gt;
ok: [localhost] =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;list&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TASK [try to loop var2] ************************************************************************************************&lt;br /&gt;
ok: [localhost] =&amp;gt; (item=foo) =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;foo&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
ok: [localhost] =&amp;gt; (item=bar) =&amp;gt; {&lt;br /&gt;
&amp;quot;msg&amp;quot;: &amp;quot;bar&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TASK [try to loop var1] ************************************************************************************************&lt;br /&gt;
fatal: [localhost]: FAILED! =&amp;gt; {&amp;quot;msg&amp;quot;: &amp;quot;Invalid data passed to 'loop', it requires a list, got this instead: foo,bar. Hint: If you passed a list/dict of just one element, try adding wantlist=True to your lookup invocation or use q/query instead of lookup.&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
PLAY RECAP *************************************************************************************************************&lt;br /&gt;
localhost                  : ok=5    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T17:56:25Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* setting variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
A variable name can only include letters, numbers, and underscores. [https://docs.python.org/3/reference/lexical_analysis.html#keywords Python keywords]  or [https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#playbook-keywords playbook keywords] are not valid variable names. A variable name cannot begin with a number. Use use double curly braces to reference them. i.e.&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ foo }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
Simple vars store a single value. &lt;br /&gt;
&lt;br /&gt;
List variables store multiple.&lt;br /&gt;
&lt;br /&gt;
referencing specific fields&lt;br /&gt;
 region: &amp;quot;{{ region[0] }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Dictionary vars store data in key-value pairs&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Combining list variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
   merged_list: &amp;quot;{{ list1 + list2 }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Combining dictionary variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
  merged_dict: &amp;quot;{{ dict1 | ansible.builtin.combine(dict2) }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
merge variables that match the given prefixes, suffixes, or regular expressions, you can use the community.general.merge_variables lookup, for example:&lt;br /&gt;
&lt;br /&gt;
 merged_variable: &amp;quot;{{ lookup('community.general.merge_variables', '__my_pattern', pattern_type='suffix') }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
Reference nested variables using either bracket notation or dot notation&lt;br /&gt;
 '{{ ansible_facts[&amp;quot;eth0&amp;quot;][&amp;quot;ipv4&amp;quot;][&amp;quot;address&amp;quot;] }}'&lt;br /&gt;
 or&lt;br /&gt;
 {{ ansible_facts.eth0.ipv4.address }}&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
Variables can be set via files (like inventory), plays or command line at run time.&lt;br /&gt;
&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Registering variables with the task keyword register.&lt;br /&gt;
&lt;br /&gt;
     - name: Run a shell command and register its output as a variable&lt;br /&gt;
       ansible.builtin.shell: /usr/bin/foo&lt;br /&gt;
       register: foo_result&lt;br /&gt;
&lt;br /&gt;
Defining variables at runtime&lt;br /&gt;
&lt;br /&gt;
key=value syntax&lt;br /&gt;
values are interpreted as strings &lt;br /&gt;
&lt;br /&gt;
 ansible-playbook release.yml --extra-vars &amp;quot;version=1.23.45 other_variable=foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use the JSON format if you need to pass non-string values such as Booleans, integers, floats, lists...&lt;br /&gt;
&lt;br /&gt;
 ansible-playbook release.yml --extra-vars '{&amp;quot;version&amp;quot;:&amp;quot;1.23.45&amp;quot;,&amp;quot;other_variable&amp;quot;:&amp;quot;foo&amp;quot;}'&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars '{&amp;quot;pacman&amp;quot;:&amp;quot;mrs&amp;quot;,&amp;quot;ghosts&amp;quot;:[&amp;quot;inky&amp;quot;,&amp;quot;pinky&amp;quot;,&amp;quot;clyde&amp;quot;,&amp;quot;sue&amp;quot;]}'&lt;br /&gt;
&lt;br /&gt;
you must escape quotes and other special characters &lt;br /&gt;
&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars &amp;quot;{\&amp;quot;name\&amp;quot;:\&amp;quot;Conan O\'Brien\&amp;quot;}&amp;quot;&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars '{&amp;quot;name&amp;quot;:&amp;quot;Conan O'\\\''Brien&amp;quot;}'&lt;br /&gt;
 ansible-playbook script.yml --extra-vars &amp;quot;{\&amp;quot;dialog\&amp;quot;:\&amp;quot;He said \\\&amp;quot;I just can\'t get enough of those single and double-quotes&amp;quot;\!&amp;quot;\\\&amp;quot;\&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T17:55:58Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* setting variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
A variable name can only include letters, numbers, and underscores. [https://docs.python.org/3/reference/lexical_analysis.html#keywords Python keywords]  or [https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#playbook-keywords playbook keywords] are not valid variable names. A variable name cannot begin with a number. Use use double curly braces to reference them. i.e.&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ foo }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
Simple vars store a single value. &lt;br /&gt;
&lt;br /&gt;
List variables store multiple.&lt;br /&gt;
&lt;br /&gt;
referencing specific fields&lt;br /&gt;
 region: &amp;quot;{{ region[0] }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Dictionary vars store data in key-value pairs&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Combining list variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
   merged_list: &amp;quot;{{ list1 + list2 }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Combining dictionary variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
  merged_dict: &amp;quot;{{ dict1 | ansible.builtin.combine(dict2) }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
merge variables that match the given prefixes, suffixes, or regular expressions, you can use the community.general.merge_variables lookup, for example:&lt;br /&gt;
&lt;br /&gt;
 merged_variable: &amp;quot;{{ lookup('community.general.merge_variables', '__my_pattern', pattern_type='suffix') }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
Reference nested variables using either bracket notation or dot notation&lt;br /&gt;
 '{{ ansible_facts[&amp;quot;eth0&amp;quot;][&amp;quot;ipv4&amp;quot;][&amp;quot;address&amp;quot;] }}'&lt;br /&gt;
 or&lt;br /&gt;
 {{ ansible_facts.eth0.ipv4.address }}&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
Variables can be set via files (like inventory), plays or command line at run time.&lt;br /&gt;
&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Registering variables with the task keyword register.&lt;br /&gt;
&lt;br /&gt;
     - name: Run a shell command and register its output as a variable&lt;br /&gt;
       ansible.builtin.shell: /usr/bin/foo&lt;br /&gt;
       register: foo_result&lt;br /&gt;
&lt;br /&gt;
Defining variables at runtime&lt;br /&gt;
&lt;br /&gt;
key=value syntax&lt;br /&gt;
values are interpreted as strings &lt;br /&gt;
&lt;br /&gt;
 ansible-playbook release.yml --extra-vars &amp;quot;version=1.23.45 other_variable=foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use the JSON format if you need to pass non-string values such as Booleans, integers, floats, lists...&lt;br /&gt;
&lt;br /&gt;
 ansible-playbook release.yml --extra-vars '{&amp;quot;version&amp;quot;:&amp;quot;1.23.45&amp;quot;,&amp;quot;other_variable&amp;quot;:&amp;quot;foo&amp;quot;}'&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars '{&amp;quot;pacman&amp;quot;:&amp;quot;mrs&amp;quot;,&amp;quot;ghosts&amp;quot;:[&amp;quot;inky&amp;quot;,&amp;quot;pinky&amp;quot;,&amp;quot;clyde&amp;quot;,&amp;quot;sue&amp;quot;]}'&lt;br /&gt;
&lt;br /&gt;
you must escape quotes and other special characters &lt;br /&gt;
&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars &amp;quot;{\&amp;quot;name\&amp;quot;:\&amp;quot;Conan O\'Brien\&amp;quot;}&amp;quot;&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars '{&amp;quot;name&amp;quot;:&amp;quot;Conan O'\\\''Brien&amp;quot;}'&lt;br /&gt;
 ansible-playbook script.yml --extra-vars &amp;quot;{\&amp;quot;dialog\&amp;quot;:\&amp;quot;He said \\\&amp;quot;I just can\'t get enough of those &lt;br /&gt;
single and double-quotes&amp;quot;\!&amp;quot;\\\&amp;quot;\&amp;quot;}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T17:49:41Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* setting variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
A variable name can only include letters, numbers, and underscores. [https://docs.python.org/3/reference/lexical_analysis.html#keywords Python keywords]  or [https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#playbook-keywords playbook keywords] are not valid variable names. A variable name cannot begin with a number. Use use double curly braces to reference them. i.e.&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ foo }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
Simple vars store a single value. &lt;br /&gt;
&lt;br /&gt;
List variables store multiple.&lt;br /&gt;
&lt;br /&gt;
referencing specific fields&lt;br /&gt;
 region: &amp;quot;{{ region[0] }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Dictionary vars store data in key-value pairs&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Combining list variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
   merged_list: &amp;quot;{{ list1 + list2 }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Combining dictionary variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
  merged_dict: &amp;quot;{{ dict1 | ansible.builtin.combine(dict2) }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
merge variables that match the given prefixes, suffixes, or regular expressions, you can use the community.general.merge_variables lookup, for example:&lt;br /&gt;
&lt;br /&gt;
 merged_variable: &amp;quot;{{ lookup('community.general.merge_variables', '__my_pattern', pattern_type='suffix') }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
Reference nested variables using either bracket notation or dot notation&lt;br /&gt;
 '{{ ansible_facts[&amp;quot;eth0&amp;quot;][&amp;quot;ipv4&amp;quot;][&amp;quot;address&amp;quot;] }}'&lt;br /&gt;
 or&lt;br /&gt;
 {{ ansible_facts.eth0.ipv4.address }}&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
Variables can be set via files (like inventory), plays or command line at run time.&lt;br /&gt;
&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Registering variables with the task keyword register.&lt;br /&gt;
&lt;br /&gt;
     - name: Run a shell command and register its output as a variable&lt;br /&gt;
       ansible.builtin.shell: /usr/bin/foo&lt;br /&gt;
       register: foo_result&lt;br /&gt;
&lt;br /&gt;
Defining variables at runtime&lt;br /&gt;
&lt;br /&gt;
key=value syntax&lt;br /&gt;
values are interpreted as strings &lt;br /&gt;
&lt;br /&gt;
 ansible-playbook release.yml --extra-vars &amp;quot;version=1.23.45 other_variable=foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use the JSON format if you need to pass non-string values such as Booleans, integers, floats, lists...&lt;br /&gt;
&lt;br /&gt;
 ansible-playbook release.yml --extra-vars '{&amp;quot;version&amp;quot;:&amp;quot;1.23.45&amp;quot;,&amp;quot;other_variable&amp;quot;:&amp;quot;foo&amp;quot;}'&lt;br /&gt;
 ansible-playbook arcade.yml --extra-vars '{&amp;quot;pacman&amp;quot;:&amp;quot;mrs&amp;quot;,&amp;quot;ghosts&amp;quot;:[&amp;quot;inky&amp;quot;,&amp;quot;pinky&amp;quot;,&amp;quot;clyde&amp;quot;,&amp;quot;sue&amp;quot;]}'&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T17:20:19Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
A variable name can only include letters, numbers, and underscores. [https://docs.python.org/3/reference/lexical_analysis.html#keywords Python keywords]  or [https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#playbook-keywords playbook keywords] are not valid variable names. A variable name cannot begin with a number. Use use double curly braces to reference them. i.e.&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ foo }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
Simple vars store a single value. &lt;br /&gt;
&lt;br /&gt;
List variables store multiple.&lt;br /&gt;
&lt;br /&gt;
referencing specific fields&lt;br /&gt;
 region: &amp;quot;{{ region[0] }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Dictionary vars store data in key-value pairs&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Combining list variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
   merged_list: &amp;quot;{{ list1 + list2 }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Combining dictionary variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
  merged_dict: &amp;quot;{{ dict1 | ansible.builtin.combine(dict2) }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
merge variables that match the given prefixes, suffixes, or regular expressions, you can use the community.general.merge_variables lookup, for example:&lt;br /&gt;
&lt;br /&gt;
 merged_variable: &amp;quot;{{ lookup('community.general.merge_variables', '__my_pattern', pattern_type='suffix') }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
Reference nested variables using either bracket notation or dot notation&lt;br /&gt;
 '{{ ansible_facts[&amp;quot;eth0&amp;quot;][&amp;quot;ipv4&amp;quot;][&amp;quot;address&amp;quot;] }}'&lt;br /&gt;
 or&lt;br /&gt;
 {{ ansible_facts.eth0.ipv4.address }}&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Registering variables with the task keyword register.&lt;br /&gt;
&lt;br /&gt;
     - name: Run a shell command and register its output as a variable&lt;br /&gt;
       ansible.builtin.shell: /usr/bin/foo&lt;br /&gt;
       register: foo_result&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T17:07:34Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
A variable name can only include letters, numbers, and underscores. [https://docs.python.org/3/reference/lexical_analysis.html#keywords Python keywords]  or [https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#playbook-keywords playbook keywords] are not valid variable names. A variable name cannot begin with a number. Use use double curly braces to reference them. i.e.&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ foo }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
Simple vars store a single value. &lt;br /&gt;
&lt;br /&gt;
List variables store multiple.&lt;br /&gt;
&lt;br /&gt;
referencing specific fields&lt;br /&gt;
 region: &amp;quot;{{ region[0] }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Dictionary vars store data in key-value pairs&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Combining list variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
   merged_list: &amp;quot;{{ list1 + list2 }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Combining dictionary variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
  merged_dict: &amp;quot;{{ dict1 | ansible.builtin.combine(dict2) }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
merge variables that match the given prefixes, suffixes, or regular expressions, you can use the community.general.merge_variables lookup, for example:&lt;br /&gt;
&lt;br /&gt;
 merged_variable: &amp;quot;{{ lookup('community.general.merge_variables', '__my_pattern', pattern_type='suffix') }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Registering variables with the task keyword register.&lt;br /&gt;
&lt;br /&gt;
     - name: Run a shell command and register its output as a variable&lt;br /&gt;
       ansible.builtin.shell: /usr/bin/foo&lt;br /&gt;
       register: foo_result&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T17:03:02Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
A variable name can only include letters, numbers, and underscores. [https://docs.python.org/3/reference/lexical_analysis.html#keywords Python keywords]  or [https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#playbook-keywords playbook keywords] are not valid variable names. A variable name cannot begin with a number. Use use double curly braces to reference them. i.e.&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ foo }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
Simple vars store a single value. &lt;br /&gt;
&lt;br /&gt;
List variables store multiple.&lt;br /&gt;
&lt;br /&gt;
referencing specific fields&lt;br /&gt;
 region: &amp;quot;{{ region[0] }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Dictionary vars store data in key-value pairs&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Combining list variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
   merged_list: &amp;quot;{{ list1 + list2 }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Combining dictionary variables&lt;br /&gt;
 ansible.builtin.set_fact:&lt;br /&gt;
  merged_dict: &amp;quot;{{ dict1 | ansible.builtin.combine(dict2) }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
merge variables that match the given prefixes, suffixes, or regular expressions, you can use the community.general.merge_variables lookup, for example:&lt;br /&gt;
&lt;br /&gt;
 merged_variable: &amp;quot;{{ lookup('community.general.merge_variables', '__my_pattern', pattern_type='suffix') }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T16:29:47Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
A variable name can only include letters, numbers, and underscores. [https://docs.python.org/3/reference/lexical_analysis.html#keywords Python keywords]  or [https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#playbook-keywords playbook keywords] are not valid variable names. A variable name cannot begin with a number. Use use double curly braces to reference them. i.e.&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ foo }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T16:28:56Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
A variable name can only include letters, numbers, and underscores. [https://docs.python.org/3/reference/lexical_analysis.html#keywords Python keywords]  or [https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#playbook-keywords playbook keywords] are not valid variable names. A variable name cannot begin with a number. Use use double curly braces to reference them.&lt;br /&gt;
&lt;br /&gt;
i.e.&lt;br /&gt;
 {{ foo }}&lt;br /&gt;
&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T15:52:30Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T15:52:18Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T15:44:46Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
&lt;br /&gt;
===types===&lt;br /&gt;
&lt;br /&gt;
get var type&lt;br /&gt;
 {{ myvar | type_debug }}&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===setting variables===&lt;br /&gt;
setfact&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T14:57:24Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* Secure credentials with Ansible Vault */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
===types===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/type_debug_filter.html ansible.builtin.type_debug filter – show input data type]&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
===set_fact===&lt;br /&gt;
&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for encrypted vault files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
use hostname/groupname from inventory file as name of the file&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php/ansible_notes</id>
		<title>ansible notes</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php/ansible_notes"/>
				<updated>2025-04-16T14:56:16Z</updated>
		
		<summary type="html">&lt;p&gt;Nighthawk: /* Secure credentials with Ansible Vault */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives https://www.redhat.com/en/services/training/ex457-red-hat-certified-specialist-in-ansible-network-automation-exam?section=objectives]&lt;br /&gt;
&lt;br /&gt;
==installation==&lt;br /&gt;
 pip install ansible&lt;br /&gt;
&lt;br /&gt;
==variables==&lt;br /&gt;
===types===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/type_debug_filter.html ansible.builtin.type_debug filter – show input data type]&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#variables-in-inventory Adding variables to inventory]===&lt;br /&gt;
&lt;br /&gt;
===set_fact===&lt;br /&gt;
&lt;br /&gt;
 - name: set a var&lt;br /&gt;
   set_fact:&lt;br /&gt;
     somevar: &amp;quot;foo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Connecting to hosts==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/vault_guide/vault.html#vault Secure credentials with Ansible Vault]===&lt;br /&gt;
&lt;br /&gt;
common commands&lt;br /&gt;
&lt;br /&gt;
 $ ansible-vault create &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault edit &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault rekey &amp;lt;path to file&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 $ ansible-vault view &amp;lt;path to file&amp;gt;&lt;br /&gt;
&lt;br /&gt;
default directories for files&lt;br /&gt;
&lt;br /&gt;
group_vars&lt;br /&gt;
&lt;br /&gt;
host_vars&lt;br /&gt;
&lt;br /&gt;
===connection plugins===&lt;br /&gt;
&lt;br /&gt;
variable ansible_connection&lt;br /&gt;
&lt;br /&gt;
listing connection types/plugins&lt;br /&gt;
 $ '''ansible-doc -t connection -l'''&lt;br /&gt;
 kubectl      Execute tasks in pods running on Kubernetes                                                                                      &lt;br /&gt;
 libvirt_lxc  Run tasks in lxc containers via libvirt                                                                                          &lt;br /&gt;
 chroot       Interact with local chroot                                                                                                       &lt;br /&gt;
 psrp         Run tasks over Microsoft PowerShell Remoting Protocol                                                                            &lt;br /&gt;
 network_cli  Use network_cli to run command on network appliances                                                                             &lt;br /&gt;
 vmware_tools Execute tasks inside a VM via VMware Tools                                                                                       &lt;br /&gt;
 ssh          connect via ssh client binary                                                                                                    &lt;br /&gt;
 httpapi      Use httpapi to run command on network appliances                                                                                 &lt;br /&gt;
 docker       Run tasks in docker containers                                                                                                   &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
==playbooks==&lt;br /&gt;
===examples===&lt;br /&gt;
 - name: My first play&lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: Print wall message&lt;br /&gt;
     ansible.builtin.command: /usr/bin/wall hello&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - name: output test &lt;br /&gt;
  hosts: myhosts&lt;br /&gt;
  tasks:&lt;br /&gt;
   - name: run uname thru awk &lt;br /&gt;
     ansible.builtin.shell:  /usr/bin/uname -a | awk '{print $NF}'&lt;br /&gt;
     register: results&lt;br /&gt;
   - debug:&lt;br /&gt;
       var: results.stdout&lt;br /&gt;
&lt;br /&gt;
 $ '''ansible-playbook -i inventory.ini shelltest.yaml'''&lt;br /&gt;
 PLAY [output test] ********************************************************************************************************************************&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [run uname thru awk] *************************************************************************************************************************&lt;br /&gt;
 changed: [10.0.0.15]&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 TASK [debug] **************************************************************************************************************************************&lt;br /&gt;
 ok: [10.0.0.15] =&amp;gt; {&lt;br /&gt;
    &amp;quot;results.stdout&amp;quot;: &amp;quot;GNU/Linux&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 PLAY RECAP ****************************************************************************************************************************************&lt;br /&gt;
 10.0.0.15                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br /&gt;
&lt;br /&gt;
==programming==&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html conditionals]===&lt;br /&gt;
&lt;br /&gt;
===[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html loops]===&lt;br /&gt;
&lt;br /&gt;
===jinja2===&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html Templating (Jinja2)]&lt;br /&gt;
==output==&lt;br /&gt;
===parsing json===&lt;br /&gt;
use community.general.json_query which uses&lt;br /&gt;
[https://jmespath.org/proposals/functions.html#join jmespath]&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html Selecting JSON data: JSON queries]&lt;br /&gt;
&lt;br /&gt;
===writing to files===&lt;br /&gt;
 - name: output to file &lt;br /&gt;
   lineinfile: &lt;br /&gt;
     insertafter: EOF&lt;br /&gt;
     dest: &amp;quot;out.txt&amp;quot;&lt;br /&gt;
     line: &amp;quot;foo bar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==modules and plugins==&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/module_plugin_guide/index.html Using Ansible modules and plugins]&lt;br /&gt;
&lt;br /&gt;
[https://thecloudops.org/difference-between-modules-and-plugins/ Difference between Modules and Plugins in Ansible]&lt;br /&gt;
&lt;br /&gt;
===collections===&lt;br /&gt;
[https://docs.ansible.com/ansible/5/user_guide/collections_using.html Using collections]&lt;br /&gt;
Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. As modules move from the core Ansible repository into collections, the module documentation will move to the collections pages.&lt;br /&gt;
&lt;br /&gt;
==use cases==&lt;br /&gt;
===network/security automation===&lt;br /&gt;
&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#platform-options platform modules (Maintained by Ansible Network Team)]&lt;br /&gt;
&lt;br /&gt;
====[https://galaxy.ansible.com/ui/namespaces/check_point/ checkpoint modules (gaia / mgmt)]====&lt;br /&gt;
&lt;br /&gt;
====fortinet====&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/fortinet/ fortinet]&lt;br /&gt;
&lt;br /&gt;
[https://docs.fortinet.com/document/fortisoar/7.4.2/playbooks-guide/767891/jinja-filters-and-functions Jinja Filters and Functions]&lt;br /&gt;
&lt;br /&gt;
[https://galaxy.ansible.com/ui/namespaces/paloaltonetworks/ paloalto]&lt;br /&gt;
===cloud===&lt;br /&gt;
====kvm====&lt;br /&gt;
[https://docs.ansible.com/ansible/latest/collections/community/libvirt/virt_module.html KVM libvirt module]&lt;br /&gt;
&lt;br /&gt;
[https://thenathan.net/2022/09/30/ansible-libvirt-dynamic-inventory/ Ansible libvirt dynamic inventory]&lt;br /&gt;
&lt;br /&gt;
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-domain_commands-connecting_the_serial_console_for_the_guest_virtual_machine Connecting the Serial Console for the Guest Virtual Machine]&lt;br /&gt;
&lt;br /&gt;
[[category:ansible]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.uni-koeln.de/~pbogusze/posts/Ansible_export_facts_to_simple_csv_file.html Ansible export facts to simple csv file]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	</feed>