├── .vscode ├── ansible-snippet-helper.code-snippets └── tasks.json ├── LICENSE ├── README.md ├── ansible-large-snippets.code-snippets ├── ansible-small-snippets.code-snippets ├── ansible.builtin.code-snippets ├── ansible.netcommon.code-snippets ├── ansible.posix.code-snippets ├── ansible.utils.code-snippets ├── community.dns.code-snippets ├── community.general.code-snippets ├── community.postgresql.code-snippets ├── container.podman.code-snippets ├── copy_snippets_global.ps1 └── copy_snippets_global.sh /.vscode/ansible-snippet-helper.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Snippet.OwnerGroupMode":{ 3 | "prefix": ["snippet.OwnerGroupMode"], 4 | "body": [ 5 | "\" owner: \\\"${$1:owner}\\\"\",", 6 | "\" group: \\\"${$2:group}\\\"\",", 7 | "\" mode: \\\"${$3:0700}\\\"\",", 8 | "$0" 9 | ], 10 | "description": "Used to make the owner / group / mode snippet used in file manipulation", 11 | "scope": "jsonc" 12 | }, 13 | 14 | "Snippet.YesNoKey":{ 15 | "prefix": ["snippet.YesNoKey"], 16 | "body": [ 17 | "\" ${1:keyname}: \\${$2|yes,no|}\",", 18 | "$0" 19 | ], 20 | "description": "Used to make a key -> Yes / No Snippet", 21 | "scope": "jsonc" 22 | }, 23 | 24 | "Snippet.TrueFalseKey":{ 25 | "prefix": ["snippet.TrueFalseKey","trueFalse_key"], 26 | "body": [ 27 | "\" ${1:keyname}: \\${$2|true,false|}\",", 28 | "$0" 29 | ], 30 | "description": "Used to make a key -> True / False Snippet", 31 | "scope": "jsonc" 32 | }, 33 | 34 | "Snippet.PresentAbsentKey":{ 35 | "prefix": ["snippet.PresentAbsentKey","absentPresent_key"], 36 | "body": [ 37 | "\" ${1:state}: \\${$2|present,absent|}\",", 38 | "$0" 39 | ], 40 | "description": "Used to make a key -> Present/Absent Snippet", 41 | "scope": "jsonc" 42 | }, 43 | 44 | "Snippet.ChoiceKey":{ 45 | "prefix": ["snippet.ChoiceKey","choice_key"], 46 | "body": [ 47 | "\" ${1:keyname}: \\${${2}|${3:choices}|}\",", 48 | "$0" 49 | ], 50 | "description": "Used to make a key -> True / False Snippet", 51 | "scope": "jsonc" 52 | }, 53 | 54 | "Snippet.KeyToFreeText":{ 55 | "prefix": ["snippet.KeyToFreeText","keytofreetext"], 56 | "body": [ 57 | "\" ${1:keyname}: \\\"${$2:${3:keyname}}\\\"\",", 58 | "$0" 59 | ], 60 | "description": "Used to make a key -> Free Text Snippet", 61 | "scope": "jsonc" 62 | }, 63 | 64 | "Snippet.OptionalTextKey":{ 65 | "prefix": ["snippet.OptionalTextKey","optional_text_key"], 66 | "body": [ 67 | "\" ${${1:keynumber}:${2:keyname}: \\\"${${3:next_key_number}:${4:next_key_name}}\\\"}\",", 68 | "$0" 69 | ], 70 | "description": "Used to make an optional snippet with a text key", 71 | "scope": "jsonc" 72 | }, 73 | 74 | "Snippet.OptionalChoiceKey":{ 75 | "prefix": ["snippet.OptionalChoiceKey","optional_choice_key"], 76 | "body": [ 77 | "\" ${${1:keynumber}:${2:keyname}: \\${${3:next_key_number}|${4:options}|}\\}\",", 78 | "$0" 79 | ], 80 | "description": "Used to make an optional snippet with a choice key", 81 | "scope": "jsonc" 82 | }, 83 | 84 | "Snippet.OptionalTrueFalseKey":{ 85 | "prefix": ["snippet.OptionalTrueFalseKey","optional_truefalse_key"], 86 | "body": [ 87 | "\" ${${1:keynumber}:${2:keyname}: \\${${3:next_key_number}|true,false|}\\}\",", 88 | "$0" 89 | ], 90 | "description": "Used to make an optional snippet with a true/false key", 91 | "scope": "jsonc" 92 | }, 93 | 94 | "Snippet.KeyBaseline":{ 95 | "prefix": ["snippet.keybaseline"], 96 | "body": [ 97 | "", 98 | " \"${1:SnippetName}\":{", 99 | " \"prefix\": [\"${2:SnippetPrefix}\"],", 100 | " \"body\": [", 101 | " $0", 102 | " ],", 103 | " \"description\": \"${3: Snippet description}\",", 104 | " \"scope\": \"${4: language}\"", 105 | " }," 106 | 107 | ], 108 | "description": "Used to make a new baseline snippet", 109 | "scope": "jsonc" 110 | }, 111 | 112 | "Snippet.AnsibleBaseline":{ 113 | "prefix": ["snippet.ansible_baseline"], 114 | "body": [ 115 | "", 116 | " \"${1:SnippetName}\":{", 117 | " \"prefix\": [\"${2:SnippetNamespace}.${3:SnippetModule}\",\"${3:SnippetModule}\"],", 118 | " \"body\": [", 119 | " \"- name: \\${1:Description}\",", 120 | " \" ${2:SnippetNamespace}.${3:SnippetModule}:\",", 121 | " $0", 122 | " \"\\$0\"", 123 | " ],", 124 | " \"description\": \"Used for Ansible ${3: Snippet description}\",", 125 | " \"scope\": \"ansible\"", 126 | " }," 127 | ], 128 | "description": "Used to make a new baseline ansible snippet", 129 | "scope": "jsonc" 130 | }, 131 | 132 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "Install Snippets Globally", 8 | "detail": "Deploys to local Linux Global Snippet location", 9 | "type": "shell", 10 | "linux": { 11 | "command": "/bin/bash copy_snippets_global.sh" 12 | }, 13 | "windows": { 14 | "options": { 15 | "shell": { 16 | "executable": "powershell", 17 | "args": [ 18 | "-ExecutionPolicy Bypass", "-File" 19 | ] 20 | } 21 | }, 22 | "command": "copy_snippets_global.ps1" 23 | }, 24 | "presentation": { 25 | "reveal": "always", 26 | "panel": "dedicated", 27 | "clear": true, 28 | "showReuseMessage": false, 29 | }, 30 | "problemMatcher": [ 31 | "$lessc" 32 | ] 33 | } 34 | ] 35 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AnsibleSnippets-VSCode 2 | 3 | A collection of snippets for VS Code to implement common patterns for snippets. Started with just the ansible.builtin namespace, but extending to other namespaces. [Screenshots](#screenshots) below 4 | 5 | ![Ansible Version](https://img.shields.io/badge/Ansible%20Version-core%202.12.1-red?logo=ansible) 6 | ![GitHub all releases](https://img.shields.io/github/downloads-pre/irontooch/AnsibleSnippets-VSCode/total) 7 | ![GitHub repo size](https://img.shields.io/github/repo-size/IronTooch/AnsibleSnippets-VSCode) 8 | ![GitHub issues](https://img.shields.io/github/issues-raw/Irontooch/AnsibleSnippets-VSCode) 9 | ![GitHub Open PRs](https://badgen.net/github/open-prs/Irontooch/AnsibleSnippets-VSCode) 10 | ![GitHub commits since tagged version](https://img.shields.io/github/commits-since/IronTooch/AnsibleSnippets-VSCode/v0.1.0?label=commits) 11 | ![GitHub last commit](https://img.shields.io/github/last-commit/IronTooch/AnsibleSnippets-VSCode) 12 | ![GitHub Release Date](https://img.shields.io/github/release-date-pre/Irontooch/AnsibleSnippets-VSCode) 13 | ![GitHub Maintained](https://img.shields.io/maintenance/yes/2022) 14 | ![GitHub](https://img.shields.io/github/license/IronTooch/AnsibleSnippets-VSCode) 15 | ![Forks](https://img.shields.io/github/forks/Irontooch/AnsibleSnippets-VSCode.svg) 16 | ![Stars](https://img.shields.io/github/stars/Irontooch/AnsibleSnippets-VSCode.svg) 17 | ![Watchers](https://img.shields.io/github/watchers/Irontooch/AnsibleSnippets-VSCode.svg) 18 | ![Follow](https://img.shields.io/github/followers/IronTooch.svg?style=social&label=Follow&maxAge=2592000) 19 | 20 | ## Usage 21 | 22 | 1. Clone the repository. 23 | 2. In VS Code, go to Terminal -> Run Task, and execute "Install Snippets Globally". 24 | 25 | Note: For updates, just do a Git Pull, and re-run the Install Snippets Globally task. This is tested in Linux Mint and Windows 10, but if you have non-standard file locations, you're on your own. Note: This requires the [Red Hat Ansible Extension for VS Code (redhat.ansible)](#required-extension), and that the [Language Mode be set to "ansible"](#setting-language-mode). You can set the language mode on a new file by pressing CTRL-K,M and typing "ansible", or going to the bottom right of the screen and switching from "Plain Text" to "Ansible". 26 | 27 | ## Comments from Author 28 | 29 | This is a work in progress. Pull requests for common patterns are welcome. Items that I (IronTooch) eventually intend to implement myself are listed in [To be Snippetized](#to-be-snippetized). Others either I don't use frequently enough to make worth my while, or don't actually know a common pattern, so that's where a pull request is definitely most welcome. 30 | 31 | ## Required Extension 32 | 33 | ![image](https://user-images.githubusercontent.com/27360514/155031172-d9c1c20e-e2f2-4ad9-a109-c2371712abae.png) 34 | 35 | ## Setting Language Mode 36 | 37 | - ![image](https://user-images.githubusercontent.com/27360514/155030919-d00f964e-53fe-4ddc-a163-52af9e0d3ee0.png) 38 | - ![image](https://user-images.githubusercontent.com/27360514/155030957-94093977-ca72-4c47-9156-3565a72de4e5.png) 39 | - ![image](https://user-images.githubusercontent.com/27360514/155031033-a6c113b8-0a51-4b83-b668-6dc8b5a30d0c.png) 40 | 41 | ## To be Snippetized 42 | 43 | ### Ansible Namespace 44 | 45 | #### ansible.posix (10 remaining) 46 | 47 | - acl – Set and retrieve file ACL information. 48 | - at – Schedule the execution of a command or script file via the at command 49 | - authorized_key – Adds or removes an SSH authorized key 50 | - firewalld – Manage arbitrary ports/services with firewalld 51 | - firewalld_info – Gather information about firewalld 52 | - patch – Apply patch files using the GNU patch tool 53 | - seboolean – Toggles SELinux booleans 54 | - selinux – Change policy and state of SELinux 55 | - synchronize – A wrapper around rsync to make common tasks in your playbooks quick and easy 56 | - sysctl – Manage entries in sysctl.conf. 57 | 58 | #### ansible.windows (40 remaining) 59 | 60 | - win_acl – Set file/directory/registry permissions for a system user or group 61 | - win_acl_inheritance – Change ACL inheritance 62 | - win_certificate_store – Manages the certificate store 63 | - win_command – Executes a command on a remote Windows node 64 | - win_copy – Copies files to remote locations on windows hosts 65 | - win_dns_client – Configures DNS lookup on Windows hosts 66 | - win_domain – Ensures the existence of a Windows domain 67 | - win_domain_controller – Manage domain controller/member server state for a Windows host 68 | - win_domain_membership – Manage domain/workgroup membership for a Windows host 69 | - win_dsc – Invokes a PowerShell DSC configuration 70 | - win_environment – Modify environment variables on windows hosts 71 | - win_feature – Installs and uninstalls Windows Features on Windows Server 72 | - win_file – Creates, touches or removes files or directories 73 | - win_find – Return a list of files based on specific criteria 74 | - win_get_url – Downloads file from HTTP, HTTPS, or FTP to node 75 | - win_group – Add and remove local groups 76 | - win_group_membership – Manage Windows local group membership 77 | - win_hostname – Manages local Windows computer name 78 | - win_optional_feature – Manage optional Windows features 79 | - win_owner – Set owner 80 | - win_package – Installs/uninstalls an installable package 81 | - win_path – Manage Windows path environment variables 82 | - win_ping – A windows version of the classic ping module 83 | - win_powershell – Run PowerShell scripts 84 | - win_reboot – Reboot a windows machine 85 | - win_reg_stat – Get information about Windows registry keys 86 | - win_regedit – Add, change, or remove registry keys and values 87 | - win_service – Manage and query Windows services 88 | - win_service_info – Gather information about Windows services 89 | - win_share – Manage Windows shares 90 | - win_shell – Execute shell commands on target hosts 91 | - win_stat – Get information about Windows files 92 | - win_tempfile – Creates temporary files and directories 93 | - win_template – Template a file out to a remote server 94 | - win_updates – Download and install Windows updates 95 | - win_uri – Interacts with webservices 96 | - win_user – Manages local Windows user accounts 97 | - win_user_right – Manage Windows User Rights 98 | - win_wait_for – Waits for a condition before continuing 99 | - win_whoami – Get information about the current user and process 100 | 101 | ### Community Namespace 102 | 103 | #### community.crypto (30 remaining) 104 | 105 | - acme_account – Create, modify or delete ACME accounts 106 | - acme_account_info – Retrieves information on ACME accounts 107 | - acme_certificate – Create SSL/TLS certificates with the ACME protocol 108 | - acme_certificate_revoke – Revoke certificates with the ACME protocol 109 | - acme_challenge_cert_helper – Prepare certificates required for ACME challenges such as tls-alpn-01 110 | - acme_inspect – Send direct requests to an ACME server 111 | - certificate_complete_chain – Complete certificate chain given a set of untrusted and root certificates 112 | - ecs_certificate – Request SSL/TLS certificates with the Entrust Certificate Services (ECS) API 113 | - ecs_domain – Request validation of a domain with the Entrust Certificate Services (ECS) API 114 | - get_certificate – Get a certificate from a host:port 115 | - luks_device – Manage encrypted (LUKS) devices 116 | - openssh_cert – Generate OpenSSH host or user certificates. 117 | - openssh_keypair – Generate OpenSSH private and public keys 118 | - openssl_csr – Generate OpenSSL Certificate Signing Request (CSR) 119 | - openssl_csr_info – Provide information of OpenSSL Certificate Signing Requests (CSR) 120 | - openssl_csr_pipe – Generate OpenSSL Certificate Signing Request (CSR) 121 | - openssl_dhparam – Generate OpenSSL Diffie-Hellman Parameters 122 | - openssl_pkcs12 – Generate OpenSSL PKCS#12 archive 123 | - openssl_privatekey – Generate OpenSSL private keys 124 | - openssl_privatekey_info – Provide information for OpenSSL private keys 125 | - openssl_privatekey_pipe – Generate OpenSSL private keys without disk access 126 | - openssl_publickey – Generate an OpenSSL public key from its private key. 127 | - openssl_publickey_info – Provide information for OpenSSL public keys 128 | - openssl_signature – Sign data with openssl 129 | - openssl_signature_info – Verify signatures with openssl 130 | - x509_certificate – Generate and/or check OpenSSL certificates 131 | - x509_certificate_info – Provide information of OpenSSL X.509 certificates 132 | - x509_certificate_pipe – Generate and/or check OpenSSL certificates 133 | - x509_crl – Generate Certificate Revocation Lists (CRLs) 134 | - x509_crl_info – Retrieve information on Certificate Revocation Lists (CRLs) 135 | 136 | #### community.docker (27 remaining) 137 | 138 | - current_container_facts – Return facts about whether the module runs in a Docker container 139 | - docker_compose – Manage multi-container Docker applications with Docker Compose. 140 | - docker_config – Manage docker configs. 141 | - docker_container – manage docker containers 142 | - docker_container_exec – Execute command in a docker container 143 | - docker_container_info – Retrieves facts about docker container 144 | - docker_host_info – Retrieves facts about docker host and lists of objects of the services. 145 | - docker_image – Manage docker images 146 | - docker_image_info – Inspect docker images 147 | - docker_image_load – Load docker image(s) from archives 148 | - docker_login – Log into a Docker registry. 149 | - docker_network – Manage Docker networks 150 | - docker_network_info – Retrieves facts about docker network 151 | - docker_node – Manage Docker Swarm node 152 | - docker_node_info – Retrieves facts about docker swarm node from Swarm Manager 153 | - docker_plugin – Manage Docker plugins 154 | - docker_prune – Allows to prune various docker objects 155 | - docker_secret – Manage docker secrets. 156 | - docker_stack – docker stack module 157 | - docker_stack_info – Return information on a docker stack 158 | - docker_stack_task_info – Return information of the tasks on a docker stack 159 | - docker_swarm – Manage Swarm cluster 160 | - docker_swarm_info – Retrieves facts about Docker Swarm cluster. 161 | - docker_swarm_service – docker swarm service 162 | - docker_swarm_service_info – Retrieves information about docker services from a Swarm Manager 163 | - docker_volume – Manage Docker volumes 164 | - docker_volume_info – Retrieve facts about Docker volumes 165 | 166 | #### community.general (127 remaining) 167 | 168 | - ansible_galaxy_install – Install Ansible roles or collections using ansible-galaxy 169 | - apache2_mod_proxy – Set and/or get members’ attributes of an Apache httpd 2.4 mod_proxy balancer pool 170 | - apache2_module – Enables/disables a module of the Apache2 webserver. 171 | - apk – Manages apk packages 172 | - apt_repo – Manage APT repositories via apt-repo 173 | - apt_rpm – apt_rpm package manager 174 | - capabilities – Manage Linux capabilities 175 | - cloudflare_dns – Manage Cloudflare DNS records 176 | - composer – Dependency Manager for PHP 177 | - cpanm – Manages Perl library dependencies. 178 | - cronvar – Manage variables in crontabs 179 | - crypttab – Encrypted Linux block devices 180 | - dconf – Modify and read dconf database 181 | - deploy_helper – Manages some of the steps common in deploying projects. 182 | - dnf_versionlock – Locks package versions in dnf based systems 183 | - dpkg_divert – Override a debian package’s version of a file 184 | - easy_install – Installs Python libraries 185 | - facter – Runs the discovery program facter on the remote system 186 | - filesize – Create a file with a given size, or resize it if it exists 187 | - filesystem – Makes a filesystem 188 | - git_config – Read and write git configuration 189 | - github_deploy_key – Manages deploy keys for GitHub repositories. 190 | - github_issue – View GitHub issue. 191 | - github_key – Manage GitHub access keys. 192 | - github_release – Interact with GitHub Releases 193 | - github_repo – Manage your repositories on Github 194 | - github_webhook – Manage GitHub webhooks 195 | - github_webhook_info – Query information about GitHub webhooks 196 | - gunicorn – Run gunicorn with various settings. 197 | - haproxy – Enable, disable, and set weights for HAProxy backend servers using socket commands 198 | - homebrew – Package manager for Homebrew 199 | - homebrew_cask – Install and uninstall homebrew casks 200 | - homebrew_tap – Tap a Homebrew repository. 201 | - htpasswd – manage user files for basic authentication 202 | - idrac_redfish_command – Manages Out-Of-Band controllers using iDRAC OEM Redfish APIs 203 | - idrac_redfish_config – Manages servers through iDRAC using Dell Redfish APIs 204 | - idrac_redfish_info – Gather PowerEdge server information through iDRAC using Redfish APIs 205 | - ilo_redfish_config – Sets or updates configuration attributes on HPE iLO with Redfish OEM extensions 206 | - ilo_redfish_info – Gathers server information through iLO using Redfish APIs 207 | - ini_file – Tweak settings in INI files 208 | - interfaces_file – Tweak settings in /etc/network/interfaces files 209 | - ip_netns – Manage network namespaces 210 | - ipify_facts – Retrieve the public IP of your internet gateway 211 | - ipinfoio_facts – Retrieve IP geolocation facts of a host’s IP address 212 | - ipmi_boot – Management of order of boot devices 213 | - ipmi_power – Power management for machine 214 | - iptables_state – Save iptables state into a file or restore it from a file 215 | - iso_create – Generate ISO file with specified files or folders 216 | - iso_extract – Extract files from an ISO image 217 | - ldap_attrs – Add or remove multiple LDAP attribute values 218 | - ldap_entry – Add or remove LDAP entries. 219 | - ldap_passwd – Set passwords in LDAP. 220 | - ldap_search – Search for entries in a LDAP server 221 | - listen_ports_facts – Gather facts on processes listening on TCP and UDP ports. 222 | - lldp – get details reported by lldp 223 | - locale_gen – Creates or removes locales 224 | - lvg – Configure LVM volume groups 225 | - lvol – Configure LVM logical volumes 226 | - lxc_container – Manage LXC Containers 227 | - lxca_cmms – Custom module for lxca cmms inventory utility 228 | - lxca_nodes – Custom module for lxca nodes inventory utility 229 | - lxd_container – Manage LXD instances 230 | - lxd_profile – Manage LXD profiles 231 | - mail – Send an email 232 | - make – Run targets in a Makefile 233 | - matrix – Send notifications to matrix 234 | - mattermost – Send Mattermost notifications 235 | - mssql_db – Add or remove MSSQL databases from a remote host. 236 | - mssql_script – Execute SQL scripts on a MSSQL database 237 | - nginx_status_info – Retrieve information on nginx status. 238 | - nmcli – Manage Networking 239 | - npm – Manage node.js packages with npm 240 | - nsupdate – Manage DNS records. 241 | - online_server_info – Gather information about Online servers. 242 | - online_user_info – Gather information about Online user. 243 | - osx_defaults – Manage macOS user defaults 244 | - pacman – Manage packages with pacman 245 | - pacman_key – Manage pacman’s list of trusted keys 246 | - pam_limits – Modify Linux PAM limits 247 | - pamd – Manage PAM Modules 248 | - parted – Configure block device partitions 249 | - pids – Retrieves process IDs list if the process is running otherwise return empty list 250 | - pip_package_info – pip package information 251 | - proxmox – management of instances in Proxmox VE cluster 252 | - proxmox_domain_info – Retrieve information about one or more Proxmox VE domains 253 | - proxmox_group_info – Retrieve information about one or more Proxmox VE groups 254 | - proxmox_kvm – Management of Qemu(KVM) Virtual Machines in Proxmox VE cluster. 255 | - proxmox_nic – Management of a NIC of a Qemu(KVM) VM in a Proxmox VE cluster. 256 | - proxmox_snap – Snapshot management of instances in Proxmox VE cluster 257 | - proxmox_storage_info – Retrieve information about one or more Proxmox VE storages 258 | - proxmox_tasks_info – Retrieve information about one or more Proxmox VE tasks 259 | - proxmox_template – management of OS templates in Proxmox VE cluster 260 | - proxmox_user_info – Retrieve information about one or more Proxmox VE users 261 | - python_requirements_info – Show python path and assert dependency versions 262 | - read_csv – Read a CSV file 263 | - redhat_subscription – Manage registration and subscriptions to RHSM using the subscription-manager command 264 | - redis – Various redis commands, replica and flush 265 | - redis_data – Set key value pairs in Redis 266 | - redis_data_incr – Increment keys in Redis 267 | - redis_data_info – Get value of key in Redis database 268 | - redis_info – Gather information about Redis servers 269 | - rhevm – RHEV/oVirt automation 270 | - rhn_channel – Adds or removes Red Hat software channels 271 | - rhn_register – Manage Red Hat Network registration using the rhnreg_ks command 272 | - rhsm_release – Set or Unset RHSM Release version 273 | - rhsm_repository – Manage RHSM repositories using the subscription-manager command 274 | - sefcontext – Manages SELinux file context mapping definitions 275 | - selinux_permissive – Change permissive domain in SELinux policy 276 | - selogin – Manages linux user to SELinux user mapping 277 | - seport – Manages SELinux network port type definitions 278 | - serverless – Manages a Serverless Framework project 279 | - shutdown – Shut down a machine 280 | - slack – Send Slack notifications 281 | - snap_alias – Manages snap aliases 282 | - snmp_facts – Retrieve facts for a device using SNMP 283 | - ssh_config – Manage SSH config for user 284 | - supervisorctl – Manage the state of a program or group of programs running via supervisord 285 | - svc – Manage daemontools services 286 | - syslogger – Log messages in the syslog 287 | - telegram – module for sending notifications via telegram 288 | - terraform – Manages a Terraform deployment (and plans) 289 | - ufw – Manage firewall with UFW 290 | - wakeonlan – Send a magic Wake-on-LAN (WoL) broadcast packet 291 | - xattr – Manage user defined extended attributes 292 | - xml – Manage bits and pieces of XML files or strings 293 | - yarn – Manage node.js packages with Yarn 294 | - yum_versionlock – Locks / unlocks a installed package(s) from being updated by yum package manager 295 | 296 | #### community.mongodb (17 remaining) 297 | 298 | - mongodb_balancer – Manages the MongoDB Sharded Cluster Balancer. 299 | - mongodb_index – Creates or drops indexes on MongoDB collections. 300 | - mongodb_info – Gather information about MongoDB instance. 301 | - mongodb_maintenance – Enables or disables maintenance mode for a secondary member. 302 | - mongodb_monitoring – Manages the free monitoring feature. 303 | - mongodb_oplog – Resizes the MongoDB oplog. 304 | - mongodb_parameter – Change an administrative parameter on a MongoDB server 305 | - mongodb_replicaset – Initialises a MongoDB replicaset. 306 | - mongodb_schema – Manages MongoDB Document Schema Validators. 307 | - mongodb_shard – Add or remove shards from a MongoDB Cluster 308 | - mongodb_shard_tag – Manage Shard Tags. 309 | - mongodb_shard_zone – Manage Shard Zones. 310 | - mongodb_shell – Run commands via the MongoDB shell. 311 | - mongodb_shutdown – Cleans up all database resources and then terminates the mongod/mongos process. 312 | - mongodb_status – Validates the status of the replicaset. 313 | - mongodb_stepdown – Step down the MongoDB node from a PRIMARY state. 314 | - mongodb_user – Adds or removes a user from a MongoDB database 315 | 316 | #### community.mysql (7 remaining) 317 | 318 | - mysql_db – Add or remove MySQL databases from a remote host 319 | - mysql_info – Gather information about MySQL servers 320 | - mysql_query – Run MySQL queries 321 | - mysql_replication – Manage MySQL replication 322 | - mysql_role – Adds, removes, or updates a MySQL role 323 | - mysql_user – Adds or removes a user from a MySQL database 324 | - mysql_variables – Manage MySQL global variables 325 | 326 | #### community.postgresql (20 remaining) 327 | 328 | - postgresql_copy – Copy data between a file/program and a PostgreSQL table 329 | - postgresql_ext – Add or remove PostgreSQL extensions from a database 330 | - postgresql_idx – Create or drop indexes from a PostgreSQL database 331 | - postgresql_info – Gather information about PostgreSQL servers 332 | - postgresql_lang – Adds, removes or changes procedural languages with a PostgreSQL database 333 | - postgresql_membership – Add or remove PostgreSQL roles from groups 334 | - postgresql_owner – Change an owner of PostgreSQL database object 335 | - postgresql_pg_hba – Add, remove or modify a rule in a pg_hba file 336 | - postgresql_ping – Check remote PostgreSQL server availability 337 | - postgresql_privs – Grant or revoke privileges on PostgreSQL database objects 338 | - postgresql_publication – Add, update, or remove PostgreSQL publication 339 | - postgresql_query – Run PostgreSQL queries 340 | - postgresql_schema – Add or remove PostgreSQL schema 341 | - postgresql_sequence – Create, drop, or alter a PostgreSQL sequence 342 | - postgresql_set – Change a PostgreSQL server configuration parameter 343 | - postgresql_slot – Add or remove replication slots from a PostgreSQL database 344 | - postgresql_subscription – Add, update, or remove PostgreSQL subscription 345 | - postgresql_table – Create, drop, or modify a PostgreSQL table 346 | - postgresql_tablespace – Add or remove PostgreSQL tablespaces from remote hosts 347 | - postgresql_user_obj_stat_info – Gather statistics about PostgreSQL user objects 348 | 349 | #### community.windows (33 remaining) 350 | 351 | - win_firewall – Enable or disable the Windows Firewall 352 | - win_firewall_rule – Windows firewall automation 353 | - win_format – Formats an existing volume or a new volume on an existing partition on Windows 354 | - win_hosts – Manages hosts file entries on Windows. 355 | - win_lineinfile – Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression 356 | - win_mapped_drive – Map network drives for users 357 | - win_msg – Sends a message to logged in users on Windows hosts 358 | - win_power_plan – Changes the power plan of a Windows system 359 | - win_product_facts – Provides Windows product and license information 360 | - win_psexec – Runs commands (remotely) as another (privileged) user 361 | - win_psmodule – Adds or removes a Windows PowerShell module 362 | - win_psmodule_info – Gather information about PowerShell Modules 363 | - win_psrepository – Adds, removes or updates a Windows PowerShell repository. 364 | - win_psscript – Install and manage PowerShell scripts from a PSRepository 365 | - win_psscript_info – Gather information about installed PowerShell Scripts 366 | - win_pssession_configuration – Manage PSSession Configurations 367 | - win_region – Set the region and format settings 368 | - win_regmerge – Merges the contents of a registry file into the Windows registry 369 | - win_robocopy – Synchronizes the contents of two directories using Robocopy 370 | - win_route – Add or remove a static route 371 | - win_say – Text to speech module for Windows to speak messages and optionally play sounds 372 | - win_scheduled_task – Manage scheduled tasks 373 | - win_scheduled_task_stat – Get information about Windows Scheduled Tasks 374 | - win_security_policy – Change local security policy settings 375 | - win_shortcut – Manage shortcuts on Windows 376 | - win_timezone – Sets Windows machine timezone 377 | - win_toast – Sends Toast windows notification to logged in users on Windows 10 or later hosts 378 | - win_unzip – Unzips compressed files and archives on the Windows node 379 | - win_user_profile – Manages the Windows user profiles. 380 | - win_wait_for_process – Waits for a process to exist or not exist before continuing. 381 | - win_wakeonlan – Send a magic Wake-on-LAN (WoL) broadcast packet 382 | - win_xml – Manages XML file content on Windows hosts 383 | - win_zip – Compress file or directory as zip archive on the Windows node 384 | 385 | ### Netbox Collections 386 | 387 | #### netbox.netbox (57 remaining) 388 | 389 | - netbox_aggregate – Creates or removes aggregates from NetBox 390 | - netbox_cable – Create, update or delete cables within NetBox 391 | - netbox_circuit – Create, update or delete circuits within NetBox 392 | - netbox_circuit_termination – Create, update or delete circuit terminations within NetBox 393 | - netbox_circuit_type – Create, update or delete circuit types within NetBox 394 | - netbox_cluster – Create, update or delete clusters within NetBox 395 | - netbox_cluster_group – Create, update or delete cluster groups within NetBox 396 | - netbox_cluster_type – Create, update or delete cluster types within NetBox 397 | - netbox_config_context – Creates, updates or deletes configuration contexts within NetBox 398 | - netbox_console_port – Create, update or delete console ports within NetBox 399 | - netbox_console_port_template – Create, update or delete console port templates within NetBox 400 | - netbox_console_server_port – Create, update or delete console server ports within NetBox 401 | - netbox_console_server_port_template – Create, update or delete console server port templates within NetBox 402 | - netbox_device – Create, update or delete devices within NetBox 403 | - netbox_device_bay – Create, update or delete device bays within NetBox 404 | - netbox_device_bay_template – Create, update or delete device bay templates within NetBox 405 | - netbox_device_interface – Creates or removes interfaces on devices from NetBox 406 | - netbox_device_interface_template – Creates or removes interfaces on devices from NetBox 407 | - netbox_device_role – Create, update or delete devices roles within NetBox 408 | - netbox_device_type – Create, update or delete device types within NetBox 409 | - netbox_front_port – Create, update or delete front ports within NetBox 410 | - netbox_front_port_template – Create, update or delete front port templates within NetBox 411 | - netbox_inventory_item – Creates or removes inventory items from NetBox 412 | - netbox_ip_address – Creates or removes IP addresses from NetBox 413 | - netbox_ipam_role – Creates or removes ipam roles from NetBox 414 | - netbox_location – Create, update or delete locations within NetBox 415 | - netbox_manufacturer – Create or delete manufacturers within NetBox 416 | - netbox_platform – Create or delete platforms within NetBox 417 | - netbox_power_feed – Create, update or delete power feeds within NetBox 418 | - netbox_power_outlet – Create, update or delete power outlets within NetBox 419 | - netbox_power_outlet_template – Create, update or delete power outlet templates within NetBox 420 | - netbox_power_panel – Create, update or delete power panels within NetBox 421 | - netbox_power_port – Create, update or delete power ports within NetBox 422 | - netbox_power_port_template – Create, update or delete power port templates within NetBox 423 | - netbox_prefix – Creates or removes prefixes from NetBox 424 | - netbox_provider – Create, update or delete providers within NetBox 425 | - netbox_provider_network – Create, update or delete provider networks within NetBox 426 | - netbox_rack – Create, update or delete racks within NetBox 427 | - netbox_rack_group – Create, update or delete racks groups within NetBox 428 | - netbox_rack_role – Create, update or delete racks roles within NetBox 429 | - netbox_rear_port – Create, update or delete rear ports within NetBox 430 | - netbox_rear_port_template – Create, update or delete rear port templates within NetBox 431 | - netbox_region – Creates or removes regions from NetBox 432 | - netbox_rir – Create, update or delete RIRs within NetBox 433 | - netbox_route_target – Creates or removes route targets from NetBox 434 | - netbox_service – Creates or removes service from NetBox 435 | - netbox_site – Creates or removes sites from NetBox 436 | - netbox_site_group – Create, update, or delete site groups within NetBox 437 | - netbox_tag – Creates or removes tags from NetBox 438 | - netbox_tenant – Creates or removes tenants from NetBox 439 | - netbox_tenant_group – Creates or removes tenant groups from NetBox 440 | - netbox_virtual_chassis – Create, update or delete virtual chassis within NetBox 441 | - netbox_virtual_machine – Create, update or delete virtual_machines within NetBox 442 | - netbox_vlan – Create, update or delete vlans within NetBox 443 | - netbox_vlan_group – Create, update or delete vlans groups within NetBox 444 | - netbox_vm_interface – Creates or removes interfaces from virtual machines in NetBox 445 | - netbox_vrf – Create, update or delete vrfs within NetBox 446 | 447 | ## Screenshots 448 | 449 | ### Block In File 450 | 451 | ---- 452 | 453 | - ![image](https://user-images.githubusercontent.com/27360514/155032030-bfb091e9-09cb-4324-9bfb-97e203aa7ee8.png) 454 | - ![image](https://user-images.githubusercontent.com/27360514/155032003-91bfbe28-232c-4f93-8104-b40301229f54.png) 455 | 456 | ### Start Block 457 | 458 | ---- 459 | 460 | - ![image](https://user-images.githubusercontent.com/27360514/155032065-7523ccaa-ad99-48a7-8b5c-ffa5a7cc4e28.png) 461 | - ![image](https://user-images.githubusercontent.com/27360514/155032088-26e4a612-f776-46a9-ab7c-a6fe5b7ffd1c.png) 462 | 463 | ### MD5 Passwords 464 | 465 | ---- 466 | 467 | - ![image](https://user-images.githubusercontent.com/27360514/155032427-93f30039-1825-4d89-a549-64de37e53eaa.png) 468 | - ![image](https://user-images.githubusercontent.com/27360514/155032535-701dfe01-3345-4677-a1ee-0f43a5318df2.png) 469 | -------------------------------------------------------------------------------- /ansible-large-snippets.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Ansible.MakeOptAndUser": { 3 | "prefix": [ 4 | "ansible.large.preinstall" 5 | ], 6 | "body": [ 7 | "- name: Add ${1:AppName} Services User", 8 | " user: ", 9 | " name: \"svc_${1:AppName}\"", 10 | " create_home: no", 11 | " force: yes", 12 | " state: present", 13 | " system: yes", 14 | " shell: /bin/bash", 15 | "", 16 | "- name: Create ${1:AppName} storage directory", 17 | " file:", 18 | " path: /opt/${1:AppName}", 19 | " state: directory", 20 | " owner: \"svc_${1:AppName}\"", 21 | " group: \"svc_${1:AppName}\"", 22 | "$0" 23 | ], 24 | "description": "Makes a folder in /opt/, creates a svc user for that opt, and a group for that svc user", 25 | "scope": "ansible" 26 | }, 27 | "Ansible.StartBlock": { 28 | "prefix": [ 29 | "ansible.large.startblock" 30 | ], 31 | "body": [ 32 | "#!/usr/bin/env ansible-playbook", 33 | "---", 34 | "- hosts: all", 35 | " become: true", 36 | " vars:", 37 | " myvar: \"myvar\"", 38 | " tasks: ", 39 | "", 40 | " $0" 41 | ], 42 | "description": "Ansible Start Block", 43 | "scope": "ansible" 44 | }, 45 | "Ansible.LatestGitRelease": { 46 | "prefix": [ 47 | "ansible.large.git_latest" 48 | ], 49 | "body": [ 50 | "- name: Get Github Latest Release asset", 51 | " block:", 52 | " - name: Set fact for API target for ${1:Github_repo}", 53 | " ansible.builtin.set_fact:", 54 | " ${3:myapp}_api_target: \"https://api.github.com/repos/{{ ${2:myapp_owner_repo_var} }}/releases/latest\"", 55 | "", 56 | " - name: Get the latest tag from Github for ${1:Github_repo}", 57 | " ansible.builtin.uri:", 58 | " url: \"{{ ${3:myapp}_api_target }}\"", 59 | " register: latest_release", 60 | "", 61 | " - name: Print latest release details for ${1}", 62 | " ansible.builtin.debug:", 63 | " msg: |", 64 | " Release name: {{ latest_release.json.name }}", 65 | " Release tag: {{ latest_release.json.tag_name }}", 66 | "", 67 | " - name: Set variable for latest release tag", 68 | " set_fact:", 69 | " latest_release_tag: \"{{ latest_release.json.tag_name }}\"", 70 | "", 71 | " - name: Set variable for latest release tag without 'v'", 72 | " set_fact:", 73 | " latest_release_semver: \"{{ latest_release_tag | replace('v','') }}\"", 74 | " when: not github_version", 75 | "", 76 | "- name: Set release version to user defined value", 77 | " ansible.builtin.set_fact:", 78 | " release_version: \"{{ github_version }}\"", 79 | " when: github_version", 80 | "", 81 | "- name: Set release version to lastest version", 82 | " ansible.builtin.set_fact:", 83 | " release_version: \"{{ latest_release_tag }}\"", 84 | " when: not github_version", 85 | "", 86 | "- name: Download release", 87 | " ansible.builtin.get_url:", 88 | " url: \"https://github.com/{{ ${2:myapp_owner_repo_var} }}/releases/download/{{ release_version }}/${4:release_file}\"", 89 | " dest: \"{{ ${5:managed_node_dest} }}\"", 90 | "$0", 91 | "", 92 | ], 93 | "description": "Ansible Get latest Git Release", 94 | "scope": "ansible" 95 | }, 96 | "Ansible.MakeCommandVariable": { 97 | "prefix": [ 98 | "ansible.large.command_variable" 99 | ], 100 | "body": [ 101 | "- name: Make command execution for ${1:my_command}", 102 | " set_fact:", 103 | " ${2:my_command}_var: >-", 104 | " ${3:my_command}", 105 | " ${4:raw_param}", 106 | " --${5:param1} ${6:param1_val}", 107 | " --${7:param2} ${8:param2_val}", 108 | "$0" 109 | ], 110 | "description": "Used for Ansible to make more complex commands", 111 | "scope": "ansible" 112 | }, 113 | "Ansible.MakeStateCompleteFlag": { 114 | "prefix": [ 115 | "ansible.large.state_complete_flag" 116 | ], 117 | "body": [ 118 | "- name: Check if ${1:condition_is_true}", 119 | " ansible.builtin.stat:", 120 | " path: \"{{ ${2:flag_name}_path }}\"", 121 | " register: ${2:flag_name}", 122 | "", 123 | "$0", 124 | " when: not ${2:flag_name}.stat.exists", 125 | "", 126 | "- name: Touch a file to demonstrate ${1:condition_is_true}", 127 | " ansible.builtin.file:", 128 | " path: \"{{ ${2:flag_name}_path }}\"", 129 | " state: touch", 130 | " mode: '0700'", 131 | " when: not ${2:flag_name}.stat.exists" 132 | ], 133 | "description": "Used for Ansible create commands to support idempotence", 134 | "scope": "ansible" 135 | }, 136 | "Ansible.RandomStringIfIdentified": { 137 | "prefix": [ 138 | "ansible.large.randomize_undefined_string" 139 | ], 140 | "body": [ 141 | "- name: Set ${1:key_description} since it was provided", 142 | " ansible.builtin.set_fact:", 143 | " ${3:key_var_to_use}: \"{{ ${2:variable_to_check} }}\"", 144 | " when: ${2:variable_to_check}", 145 | " no_log: true", 146 | "", 147 | "- name: Create ${1:key_description} since it was not provided", 148 | " ansible.builtin.set_fact:", 149 | " ${3:key_var_to_use}: \"{{ lookup('community.general.random_string', length=24, special=false) }}\"", 150 | " when: not ${2:variable_to_check}", 151 | " no_log: true", 152 | "", 153 | "- name: Drop copy of ${3:key_var_to_use} on local box", 154 | " ansible.builtin.copy:", 155 | " content: \"{{ ${3:key_var_to_use} }}\"", 156 | " dest: \"{{ ${4:my_app}_password_path }}\"", 157 | " force: true", 158 | " owner: \"root\"", 159 | " group: \"root\"", 160 | " mode: '0700'", 161 | " when: ${4:my_app}_password_path", 162 | " no_log: true", 163 | "", 164 | "$0" 165 | ], 166 | "description": "A snippet to make a variable if the default was not given", 167 | "scope": "ansible" 168 | }, 169 | 170 | "Ansible.FindSingleFile":{ 171 | "prefix": ["ansible.large.findFile","findFile"], 172 | "body": [ 173 | "- name: Find the ${1:file_description}", 174 | " ansible.builtin.find:", 175 | " paths: \"{{ ${2:search_dir_var} }}\"", 176 | " patterns: \"*${3:regex_to_find}*\"", 177 | " file_type: file", 178 | " register: find_results", 179 | "", 180 | "- name: Set fact to found file", 181 | " ansible.builtin.set_fact:", 182 | " found_file: \"{{ (find_results.files | first).path }}\"", 183 | "$0" 184 | ], 185 | "description": "Used to locate a single file with an unclear name", 186 | "scope": "ansible" 187 | }, 188 | 189 | "Ansible.FindSingleDir":{ 190 | "prefix": ["ansible.large.findDir","findDir"], 191 | "body": [ 192 | "- name: Find the ${1:file_description}", 193 | " ansible.builtin.find:", 194 | " paths: \"{{ ${2:search_dir_var} }}\"", 195 | " patterns: \"*${3:regex_to_find}*\"", 196 | " file_type: directory", 197 | " register: find_results", 198 | "", 199 | "- name: Set fact to found file", 200 | " ansible.builtin.set_fact:", 201 | " found_dir: \"{{ (find_results.files | first).path }}\"", 202 | "$0" 203 | ], 204 | "description": "Used to locate a single directory with an unclear name", 205 | "scope": "ansible" 206 | }, 207 | 208 | } -------------------------------------------------------------------------------- /ansible-small-snippets.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Ansible.PasswordHash": { 3 | "prefix": [ 4 | "ansible.small.md5_password" 5 | ], 6 | "body": [ 7 | "\"{{'${1:mypassword}' | hash('md5')}}\"", 8 | ], 9 | "description": "Used for Ansible to generate md5 passwords hashes for things", 10 | "scope": "ansible" 11 | }, 12 | "Ansible.FileContent": { 13 | "prefix": [ 14 | "ansible.small.file_content" 15 | ], 16 | "body": [ 17 | "{{lookup('file', '${1:filename}') }}", 18 | ], 19 | "description": "Used for Ansible to read a file on the CONTROL NODE Only", 20 | "scope": "ansible" 21 | }, 22 | "Ansible.Ipv4": { 23 | "prefix": [ 24 | "ansible.small.ipv4" 25 | ], 26 | "body": [ 27 | "{{ ansible_default_ipv4.address }}", 28 | ], 29 | "description": "Used for Ansible to get an IPv4 address", 30 | "scope": "ansible" 31 | }, 32 | "Ansible.RandomString": { 33 | "prefix": [ 34 | "ansible.small.random_string" 35 | ], 36 | "body": [ 37 | "{{ lookup('password', '/dev/null chars=ascii_letters,digits,punctuation length=${1:string_len}') }}", 38 | ], 39 | "description": "Used for Ansible to make a random string", 40 | "scope": "ansible" 41 | }, 42 | "Ansible.HandyFacts": { 43 | "prefix": [ 44 | "ansible.small.handy_facts", 45 | "handy_facts" 46 | ], 47 | "body": [ 48 | "{{ ${1|ansible_lsb.description,ansible_default_ipv4.address,ansible_fqdn,ansible_user_id,ansible_os_family|} }}$0", 49 | ], 50 | "description": "Used for Ansible to provide the most commonly used facts", 51 | "scope": "ansible" 52 | }, 53 | "Ansible.Environment": { 54 | "prefix": [ 55 | "ansible.small.environment", 56 | "env" 57 | ], 58 | "body": [ 59 | "{{ lookup('env', '${1:environment_variable_name}') }}" 60 | ], 61 | "description": "Used for Ansible to look at the Environment variables on the CONTROLLER to feed values", 62 | "scope": "ansible" 63 | }, 64 | } -------------------------------------------------------------------------------- /ansible.builtin.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Ansible.BuiltIn.Add_host": { 3 | "prefix": [ 4 | "ansible.builtin.add_host", 5 | "add_host" 6 | ], 7 | "body": [ 8 | "- name: ${1:Description}", 9 | " ansible.builtin.add_host:", 10 | " hostname: \"${2:host_or_ip_to_add}\"", 11 | "$0" 12 | ], 13 | "description": "Used for Ansible Add Host to add a host to the in-memory processing", 14 | "scope": "ansible" 15 | }, 16 | "Ansible.BuiltIn.Assemble": { 17 | "prefix": [ 18 | "ansible.builtin.assemble", 19 | "assemble" 20 | ], 21 | "body": [ 22 | "- name: ${1:Description}", 23 | " ansible.builtin.assemble:", 24 | " src: \"${2:source_folder}\"", 25 | " dest: \"${3:destination_location}\"", 26 | " ignore_hidden: ${4|true,false|}${5:", 27 | " regexp: \"${6:regexp_of_filenames_to_assemble}\"}${7:", 28 | " remote_src: ${8|true,false|}}${9:", 29 | " owner: \"${10:owner}\"}${11:", 30 | " group: \"${12:${10:owner}}\"}${13:", 31 | " mode: \"${14:0700}\"}", 32 | "$0" 33 | ], 34 | "description": "Used for Ansible Assemble Module to build files", 35 | "scope": "ansible" 36 | }, 37 | "Ansible.BuiltIn.Apt_Packages": { 38 | "prefix": [ 39 | "ansible.builtin.apt_packages", 40 | "apt_installpackages" 41 | ], 42 | "body": [ 43 | "- name: ${1:Description}", 44 | " ansible.builtin.apt:", 45 | " name:", 46 | " - ${2}", 47 | " state: ${3|present,absent,latest,fixed,build-dep|}", 48 | " update_cache: ${4|true,false|}", 49 | " register: apt_status", 50 | " until: apt_status is success", 51 | " delay: 6", 52 | " retries: 10", 53 | "$0" 54 | ], 55 | "description": "Used for Ansible Apt Module to install packages from repos", 56 | "scope": "ansible" 57 | }, 58 | "Ansible.BuiltIn.Apt_FullUpdate": { 59 | "prefix": [ 60 | "ansible.builtin.apt_fullupdate", 61 | "apt_update", 62 | "apt_fullupdate" 63 | ], 64 | "body": [ 65 | "- name: Update all packages to latest version", 66 | " ansible.builtin.apt:", 67 | " name: \"*\"", 68 | " state: \"latest\"", 69 | "$0" 70 | ], 71 | "description": "Used for Ansible Apt Module to update all packages to latest", 72 | "scope": "ansible" 73 | }, 74 | "Ansible.BuiltIn.Apt_InstallDeb": { 75 | "prefix": [ 76 | "ansible.builtin.apt_deb", 77 | "apt_installdeb" 78 | ], 79 | "body": [ 80 | "- name: Install package from ${1:debfile}", 81 | " ansible.builtin.apt:", 82 | " deb: \"${2:debpath}/${1}\"", 83 | "$0" 84 | ], 85 | "description": "Used for Ansible Apt Module to install a specific deb file", 86 | "scope": "ansible" 87 | }, 88 | "Ansible.BuiltIn.Apt_Key_FromFile": { 89 | "prefix": [ 90 | "ansible.builtin.apt_key", 91 | "apt_key_fromfile" 92 | ], 93 | "body": [ 94 | "- name: ${1:Description}", 95 | " ansible.builtin.apt_key:", 96 | " data: \"{{ lookup('file', '${2:file_path_on_server}') }}\"", 97 | " state: ${3|present,absent|}${4:", 98 | " keyring: \"${5:path_to_keyring_file}\"}", 99 | "$0" 100 | ], 101 | "description": "Used for Ansible Apt_Key", 102 | "scope": "ansible" 103 | }, 104 | "Ansible.BuiltIn.Apt_Key_FromServer": { 105 | "prefix": [ 106 | "ansible.builtin.apt_key", 107 | "apt_key_fromserver" 108 | ], 109 | "body": [ 110 | "- name: ${1:Description}", 111 | " ansible.builtin.apt_key:", 112 | " url: \"${2:url_of_key}\"", 113 | " state: ${3|present,absent|}", 114 | " validate_certs: ${4|true,false|}${5:", 115 | " keyring: \"${6:path_to_keyring_file}\"}", 116 | "$0" 117 | ], 118 | "description": "Used for Ansible Apt_Key", 119 | "scope": "ansible" 120 | }, 121 | "Ansible.BuiltIn.Apt_Repository": { 122 | "prefix": [ 123 | "ansible.builtin.apt_repository", 124 | "apt_repository" 125 | ], 126 | "body": [ 127 | "- name: ${1:Description}", 128 | " ansible.builtin.apt_repository:", 129 | " repo: \"${2:repo_source_string}\"", 130 | " state: ${3|present,absent|}${4:", 131 | " update_cache: ${5|true,false|}}${6:", 132 | " validate_certs: ${7|true,false|}}", 133 | "$0" 134 | ], 135 | "description": "Used for Ansible Apt Repository to add repositories", 136 | "scope": "ansible" 137 | }, 138 | "Ansible.BuiltIn.Assert": { 139 | "prefix": [ 140 | "ansible.builtin.assert", 141 | "assert" 142 | ], 143 | "body": [ 144 | "- name: ${1:Description}", 145 | " ansible.builtin.assert:", 146 | " that:", 147 | " - ${2:condition_that_must_be_true}${3:", 148 | " fail_msg: \"${4:msg_to_print_on_failure}\"}${5:", 149 | " success_msg: \"${6:msg_to_print_on_success}\"}", 150 | "$0" 151 | ], 152 | "description": "Used for Ansible Assert Module to establish truth", 153 | "scope": "ansible" 154 | }, 155 | "Ansible.BuiltIn.Async_Status": { 156 | // https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html#playbooks-async 157 | "prefix": [ 158 | "ansible.builtin.async_status", 159 | "async_status" 160 | ], 161 | "body": [ 162 | "- name: ${1:Description}", 163 | " ansible.builtin.async_status:", 164 | " jid: '{{ ${2:variable_of_async_task}.ansible_job_id }}", 165 | " register: job_result", 166 | " until: job_result.finished", 167 | " retries: 100", 168 | " delay: 10", 169 | "$0" 170 | ], 171 | "description": "Used for Ansible Async Job to wait for a job to complete", 172 | "scope": "ansible" 173 | }, 174 | "Ansible.BuiltIn.BlockInFile": { 175 | "prefix": [ 176 | "ansible.builtin.blockinfile", 177 | "blockinfile" 178 | ], 179 | "body": [ 180 | "- name: ${1:Description}", 181 | " ansible.builtin.blockinfile:", 182 | " path: \"${2:file_to_modify}\"", 183 | " create: ${3|true,false|}", 184 | " state: ${4|present,absent|}${5:", 185 | " insertafter: \"${6:regex_to_start_at}\"}${7:", 186 | " insertbefore: \"${8:regex_to_end_at}\"}${9:", 187 | " owner: \"${10:owner}\"}${11:", 188 | " group: \"${12:${10:owner}}\"}${13:", 189 | " mode: \"${14:0700}\"}", 190 | " block: | ", 191 | " ${15:first_line_to_add}", 192 | " ${16:second_line_to_add}", 193 | "$0" 194 | ], 195 | "description": "Used for Ansible Block in File Module to add items to block", 196 | "scope": "ansible" 197 | }, 198 | "Ansible.BuiltIn.Command": { 199 | "prefix": [ 200 | "ansible.builtin.command", 201 | "command", 202 | "cmd" 203 | ], 204 | "body": [ 205 | "- name: ${1:Description}", 206 | " ansible.builtin.command:", 207 | " cmd: \"${2}\"${3:", 208 | " chdir: \"${4}\"}${5:", 209 | " creates: \"${6:file_if_present_dont_run}\"}${7:", 210 | " removes: \"${8:file_if_present_do_run}\"}", 211 | "$0" 212 | ], 213 | "description": "Used for Ansible Command Module (No environmment variables)", 214 | "scope": "ansible" 215 | }, 216 | "Ansible.BuiltIn.Copy_Files": { 217 | "prefix": [ 218 | "ansible.builtin.copy", 219 | "copy_files" 220 | ], 221 | "body": [ 222 | "- name: ${1:Description}", 223 | " ansible.builtin.copy:", 224 | " src: \"${2}\"", 225 | " dest: \"${3}\"", 226 | " remote_src: ${4|true,false|}", 227 | " force: ${5|true,false|}${6:", 228 | " owner: \"${7:owner}\"}${8:", 229 | " group: \"${9:${7:owner}}\"}${10:", 230 | " mode: \"${11:0700}\"}", 231 | "$0" 232 | ], 233 | "description": "Used for Ansible Copy Module to copy files", 234 | "scope": "ansible" 235 | }, 236 | "Ansible.BuiltIn.Copy_Content": { 237 | "prefix": [ 238 | "ansible.builtin.copy", 239 | "copy_content" 240 | ], 241 | "body": [ 242 | "- name: ${1:Description}", 243 | " ansible.builtin.copy:", 244 | " content: \"${2}\"", 245 | " dest: \"${3}\"", 246 | " force: ${4|true,false|}${6:", 247 | " owner: \"${7:owner}\"}${8:", 248 | " group: \"${9:${7:owner}}\"}${10:", 249 | " mode: \"${11:0700}\"}", 250 | "$0" 251 | ], 252 | "description": "Used for Ansible Copy Module to copy files", 253 | "scope": "ansible" 254 | }, 255 | "Ansible.BuiltIn.Cron": { 256 | "prefix": [ 257 | "ansible.builtin.cron", 258 | "cron" 259 | ], 260 | "body": [ 261 | "- name: ${1:Description}", 262 | " ansible.builtin.cron:", 263 | " name: \"${2:description_of_job}\"", 264 | " state: ${3|present,absent|}${5:", 265 | " special_time: \"${6|annually,daily,hourly,monthly,reboot,weekly,yearly|}\"}${7:", 266 | " minute: \"${8:minute_of_hour}\"}${9:", 267 | " hour: \"${10:hour_of_day}\"}${11:", 268 | " day: \"${12:day_of_month}\"}${13:", 269 | " month: \"${14:month_of_year}\"}${15:", 270 | " weekday: \"${16:number_day_of_week}\"}${17:", 271 | " user: \"${18:users_crontab_to_edit}\"}", 272 | " job: \"${19:job_to_run}\"", 273 | "$0" 274 | ], 275 | "description": "Used for Ansible Cron to make a new scheduled job", 276 | "scope": "ansible" 277 | }, 278 | "Ansible.BuiltIn.Debconf": { 279 | "prefix": [ 280 | "ansible.builtin.debconf", 281 | "debconf" 282 | ], 283 | "body": [ 284 | "- name: ${1:Description}", 285 | " ansible.builtin.debconf:", 286 | " name: \"${2:package_to_configure}\"${3:", 287 | " unseen: ${4|no,yes|}}${5:", 288 | " vtype: ${6|boolean,error,multiselect,note,password,seen,select,string,text,title|}}", 289 | " question: \"${7:debconf_configuration_setting}\"", 290 | " value: \"${8:answer_to_question}\"", 291 | "$0" 292 | ], 293 | "description": "Used for Ansible to configure options for packages using debconf", 294 | "scope": "ansible" 295 | }, 296 | "Ansible.BuiltIn.Debug": { 297 | "prefix": [ 298 | "ansible.builtin.debug", 299 | "debug" 300 | ], 301 | "body": [ 302 | "- name: ${1:Description}", 303 | " ansible.builtin.debug:", 304 | " msg: \"${2:message}\"", 305 | "$0" 306 | ], 307 | "description": "Used for Ansible Debug Module to print output", 308 | "scope": "ansible" 309 | }, 310 | "Ansible.BuiltIn.Debug_Var": { 311 | "prefix": [ 312 | "ansible.builtin.debug_var", 313 | "debug_var" 314 | ], 315 | "body": [ 316 | "- name: Print the value of the variable $TM_SELECTED_TEXT", 317 | " ansible.builtin.debug:", 318 | " msg: \"$TM_SELECTED_TEXT: {{ $TM_SELECTED_TEXT }} \"", 319 | "$0" 320 | ], 321 | "description": "Used for Ansible Debug Module to print a selected variable", 322 | "scope": "ansible" 323 | }, 324 | "Ansible.BuiltIn.Dnf": { 325 | "prefix": [ 326 | "ansible.builtin.dnf", 327 | "dnf" 328 | ], 329 | "body": [ 330 | "- name: ${1:Description}", 331 | " ansible.builtin.dnf:", 332 | " name:", 333 | " - ${2}", 334 | " state: ${3|present,absent,installed,removed,latest|}", 335 | " update_cache: ${4|true,false|}", 336 | " register: dnf_status", 337 | " until: dnf_status is success", 338 | " delay: 6", 339 | " retries: 10", 340 | "$0" 341 | ], 342 | "description": "Used for Ansible Dnf Module to install packages from repos", 343 | "scope": "ansible" 344 | }, 345 | "Ansible.BuiltIn.Dpkg_Selections": { 346 | "prefix": [ 347 | "ansible.builtin.dpkg_selections", 348 | "dpkg_selections" 349 | ], 350 | "body": [ 351 | "- name: ${1:Description}", 352 | " ansible.builtin.dpkg_selections:", 353 | " name: \"${2:package_to_configure}\"", 354 | " selection: ${3|install,hold,deinstall,purge|}", 355 | "$0" 356 | ], 357 | "description": "Used for Ansible to set the status for packages via dpkg", 358 | "scope": "ansible" 359 | }, 360 | "Ansible.BuiltIn.Expect": { 361 | "prefix": [ 362 | "ansible.builtin.expect", 363 | "expect" 364 | ], 365 | "body": [ 366 | "- name: ${1:Description}", 367 | " ansible.builtin.expect:", 368 | " command: \"${2:command_to_run}\"${3:", 369 | " chdir: \"${4}\"}${5:", 370 | " creates: \"${6:file_if_present_dont_run}\"}${7:", 371 | " removes: \"${8:file_if_present_do_run}\"}", 372 | " responses:", 373 | " (?i)${9:question_to_answer}:${10:answer_to_question}", 374 | "$0" 375 | ], 376 | "description": "Used for Ansible Expect Module to answer given questions", 377 | "scope": "ansible" 378 | }, 379 | "Ansible.BuiltIn.Fail": { 380 | "prefix": [ 381 | "ansible.builtin.fail", 382 | "fail" 383 | ], 384 | "body": [ 385 | "- name: ${1:Description}", 386 | " ansible.builtin.fail:${2:", 387 | " msg: \"${3:failure_message}\"}", 388 | "$0" 389 | ], 390 | "description": "Used for Ansible Fail Module", 391 | "scope": "ansible" 392 | }, 393 | "Ansible.Builtin.Fetch": { 394 | "prefix": [ 395 | "ansible.builtin.fetch", 396 | "fetch" 397 | ], 398 | "body": [ 399 | "- name: ${1:Description}", 400 | " ansible.builtin.fetch:", 401 | " src: \"${2:path_on_remote_system}\"", 402 | " dest: \"${3:path_on_control_node}\"${4:", 403 | " fail_on_missing: ${5|false,true|}}${6:", 404 | " flat: ${7|false,true|}}${8:", 405 | " validate_checksum: ${9|false,true|}}", 406 | "$0" 407 | ], 408 | "description": "Used for Ansible Fetch Module to retrieve file from node", 409 | "scope": "ansible" 410 | }, 411 | "Ansible.BuiltIn.Find_ByAge": { 412 | "prefix": [ 413 | "ansible.builtin.find", 414 | "find_byage" 415 | ], 416 | "body": [ 417 | "- name: ${1:Description}", 418 | " ansible.builtin.find:", 419 | " paths: \"${2:path_to_search}\"", 420 | " age: \"${4:age_number}${5|a,m,h,d,w|}\"${6:", 421 | " age_stamp: ${7|mtime,atime,ctime|}}${8:", 422 | " file_type: ${9|file,any,directory,link|}}${10:", 423 | " hidden: ${11|false,true|}}${12:", 424 | " recurse: ${13|true,false|}}${14:", 425 | " patterns: \"${15:regex_to_match}\"}${16:", 426 | " excludes: \"${17:regex_to_exclude}\"}", 427 | " register: find_results", 428 | "$0" 429 | ], 430 | "description": "Used for Ansible find a file or directory by age", 431 | "scope": "ansible" 432 | }, 433 | "Ansible.BuiltIn.Find_ByContent": { 434 | "prefix": [ 435 | "ansible.builtin.find", 436 | "find_bycontent" 437 | ], 438 | "body": [ 439 | "- name: ${1:Description}", 440 | " ansible.builtin.find:", 441 | " paths: \"${2:path_to_search}\"", 442 | " contains: \"${3:data_in_file}\"", 443 | " file_type: file${10:", 444 | " hidden: ${11|false,true|}}${12:", 445 | " recurse: ${13|true,false|}}${14:", 446 | " patterns: \"${15:regex_to_match}\"}${16:", 447 | " excludes: \"${17:regex_to_exclude}\"}", 448 | " register: find_results", 449 | "$0" 450 | ], 451 | "description": "Used for Ansible find to find content inside a file", 452 | "scope": "ansible" 453 | }, 454 | "Ansible.BuiltIn.Find_ByName": { 455 | "prefix": [ 456 | "ansible.builtin.find", 457 | "find_byname" 458 | ], 459 | "body": [ 460 | "- name: ${1:Description}", 461 | " ansible.builtin.find:", 462 | " paths: \"${2:path_to_search}\"", 463 | " patterns: \"*${3:regex_to_match}*\"}${4:", 464 | " file_type: ${9|file,any,directory,link|}}${10:", 465 | " hidden: ${11|false,true|}}${12:", 466 | " recurse: ${13|true,false|}}${14:", 467 | " excludes: \"${17:regex_to_exclude}\"}", 468 | " register: find_results", 469 | "$0" 470 | ], 471 | "description": "Used for Ansible find a file or directory by name", 472 | "scope": "ansible" 473 | }, 474 | "Ansible.BuiltIn.FileDirectory": { 475 | "prefix": [ 476 | "ansible.builtin.file", 477 | "file_mkdir" 478 | ], 479 | "body": [ 480 | "- name: ${1:Description}", 481 | " ansible.builtin.file:", 482 | " path: ${2:path}", 483 | " state: directory", 484 | " mode: '${3:0755}'", 485 | "$0" 486 | ], 487 | "description": "Used for Ansible File Module to make directories", 488 | "scope": "ansible" 489 | }, 490 | "Ansible.BuiltIn.FileChown": { 491 | "prefix": [ 492 | "ansible.builtin.file", 493 | "file_chown" 494 | ], 495 | "body": [ 496 | "- name: ${1:Description}", 497 | " ansible.builtin.file:", 498 | " path: ${2:path}", 499 | " state: directory", 500 | " recurse: ${3|true,false|}", 501 | " owner: '${4:owner}'", 502 | " group: '${5:group}'", 503 | "$0" 504 | ], 505 | "description": "Used for Ansible File Module to Chown directories", 506 | "scope": "ansible" 507 | }, 508 | "Ansible.BuiltIn.FileLink": { 509 | "prefix": [ 510 | "ansible.builtin.file", 511 | "file_link" 512 | ], 513 | "body": [ 514 | "- name: Make Symbolic Link between ${2:path} and ${3:directory}", 515 | " ansible.builtin.file:", 516 | " src: ${2:path}", 517 | " dest: ${3:directory}", 518 | " owner: ${4:owner}", 519 | " group: ${4:owner}", 520 | " state: link", 521 | "$0" 522 | ], 523 | "description": "Used for Ansible File Module to make Symbolic Link", 524 | "scope": "ansible" 525 | }, 526 | "Ansible.BuiltIn.FileTouch": { 527 | "prefix": [ 528 | "ansible.builtin.file", 529 | "file_touch" 530 | ], 531 | "body": [ 532 | "- name: ${1:Description}", 533 | " ansible.builtin.file:", 534 | " path: \"${2:path_to_new_file}\"", 535 | " state: touch", 536 | "$0" 537 | ], 538 | "description": "Used for Ansible File to Touch new Files", 539 | "scope": "ansible" 540 | }, 541 | "Ansible.BuiltIn.GetEnt": { 542 | "prefix": [ 543 | "ansible.builtin.getent", 544 | "getent" 545 | ], 546 | "body": [ 547 | "- name: ${1:Description}", 548 | " ansible.builtin.getent:", 549 | " database: ${2|ahosts,ahostsv4,ahostsv6,aliases,ethers,group,gshadow,hosts,initgroups,netgroup,networks,passwd,protocols,rpc,services,shadow|}", 550 | " key: \"${3:key_to_search_for}\"${4:", 551 | " fail_key: ${5|false,true|}}${6:", 552 | " split: '${7:split_characters}'}", 553 | "$0" 554 | ], 555 | "description": "Used for Ansible getent to read system databases", 556 | "scope": "ansible" 557 | }, 558 | "Ansible.BuiltIn.GetUrl": { 559 | "prefix": [ 560 | "ansible.builtin.get_url", 561 | "get_url" 562 | ], 563 | "body": [ 564 | "- name: ${1:Description}", 565 | " ansible.builtin.get_url:", 566 | " url: \"${2:url}\"", 567 | " dest: \"${3:dest}\"", 568 | " force: ${4|true,false|}${5:", 569 | " owner: \"${6:owner}\"}${7:", 570 | " group: \"${8:${6:owner}}\"}${9:", 571 | " mode: \"${10:0700}\"}${11:", 572 | " validate_certs: ${12|true,false|}}", 573 | "$0" 574 | ], 575 | "description": "Used for Ansible Get_url Module to downloads files from HTTP, HTTPS, or FTP to node", 576 | "scope": "ansible" 577 | }, 578 | "Ansible.BuiltIn.Git": { 579 | "prefix": [ 580 | "ansible.builtin.git", 581 | "git" 582 | ], 583 | "body": [ 584 | "- name: ${1:Description}", 585 | " ansible.builtin.git:", 586 | " repo: \"${2:url}\"", 587 | " dest: \"${3:dest}\"", 588 | " force: ${4|true,false|}", 589 | "$0" 590 | ], 591 | "description": "Used for Ansible Git Module to download files from Git", 592 | "scope": "ansible" 593 | }, 594 | "Ansible.BuiltIn.Group": { 595 | "prefix": [ 596 | "ansible.builtin.group", 597 | "group" 598 | ], 599 | "body": [ 600 | "- name: ${1:Description}", 601 | " ansible.builtin.group:", 602 | " name: \"${2:Group_Name}\"${3:", 603 | " gid: \"${4:guid}\"}", 604 | " local: ${5|false,true|}", 605 | " state: ${6|present,absent|}", 606 | " system: ${7|false,true|}", 607 | "$0" 608 | ], 609 | "description": "Used for Ansible Group Module to make user groups", 610 | "scope": "ansible" 611 | }, 612 | "Ansible.BuiltIn.Group_By": { 613 | "prefix": [ 614 | "ansible.builtin.group_by", 615 | "group_by" 616 | ], 617 | "body": [ 618 | "- name: ${1:Description}", 619 | " ansible.builtin.group_by:", 620 | " key: ${2:variable_to_identify_group}${3:", 621 | " parents:", 622 | " - ${4:next_key_name}\"}", 623 | "$0" 624 | ], 625 | "description": "Used for Ansible Group By Module to make Ad-Hoc groups", 626 | "scope": "ansible" 627 | }, 628 | "Ansible.BuiltIn.Hostname": { 629 | "prefix": [ 630 | "ansible.builtin.hostname", 631 | "hostname" 632 | ], 633 | "body": [ 634 | "- name: ${1:Description}", 635 | " ansible.builtin.hostname:", 636 | " name: \"${2:desired_hostname}\"${3:", 637 | " use: ${4|alpine,debian,freebsd,generic,macos,macosx,darwin,openbsd,openrc,redhat,sles,solaris,systemd|}}", 638 | "$0" 639 | ], 640 | "description": "Used for Ansible Hostname Module to change a system hostname", 641 | "scope": "ansible" 642 | }, 643 | "Ansible.BuiltIn.Import_Playbook": { 644 | "prefix": [ 645 | "ansible.builtin.import_playbook", 646 | "import_playbook" 647 | ], 648 | "body": [ 649 | "- name: ${1:Description}", 650 | " ansible.builtin.import_playbook: ${2:playbook_to_import}${3:", 651 | " vars:", 652 | " ${4:variable_name}: \"${5:variable_value}\"}", 653 | "$0" 654 | ], 655 | "description": "Used for Ansible import_playbook", 656 | "scope": "ansible" 657 | }, 658 | "Ansible.BuiltIn.Import_Role": { 659 | "prefix": [ 660 | "ansible.builtin.import_role", 661 | "import_role" 662 | ], 663 | "body": [ 664 | "- name: ${1:Description}", 665 | " ansible.builtin.import_role:", 666 | " name: \"${2:role_to_import}\"", 667 | " allow_duplicates: ${3|true,false|}${4:", 668 | " vars:", 669 | " ${5:role_var_name}: ${6:role_var_value}}", 670 | "$0" 671 | ], 672 | "description": "Used for Ansible Import Role to use Role for a given function", 673 | "scope": "ansible" 674 | }, 675 | "Ansible.BuiltIn.Import_Tasks": { 676 | "prefix": [ 677 | "ansible.builtin.import_tasks", 678 | "import_tasks" 679 | ], 680 | "body": [ 681 | "- name: ${1:Description}", 682 | " ansible.builtin.import_tasks: ${2:file_name}", 683 | "$0" 684 | ], 685 | "description": "Used for Ansible Import Tasks Module to Staticly include a task list", 686 | "scope": "ansible" 687 | }, 688 | "Ansible.BuiltIn.Include_Role": { 689 | "prefix": [ 690 | "ansible.builtin.include_role", 691 | "include_role" 692 | ], 693 | "body": [ 694 | "- name: ${1:Description}", 695 | " ansible.builtin.include_role:", 696 | " name: ${2:role_to_include}", 697 | " allow_duplicates: ${3|true,false|}", 698 | " public: ${4|false,true|}${5:", 699 | " vars:", 700 | " ${6:role_var_name}: ${7:role_var_value}}", 701 | "$0" 702 | ], 703 | "description": "Used for Ansible Include Role to use Role Dynamically, at runtime, for a given function", 704 | "scope": "ansible" 705 | }, 706 | "Ansible.BuiltIn.Include_Tasks": { 707 | "prefix": [ 708 | "ansible.builtin.include_tasks", 709 | "include_tasks" 710 | ], 711 | "body": [ 712 | "- name: ${1:Description}", 713 | " ansible.builtin.include_tasks: ${2:file_name}", 714 | "$0" 715 | ], 716 | "description": "Used for Ansible Include Tasks Module to Dynamically include a task list", 717 | "scope": "ansible" 718 | }, 719 | "Ansible.BuiltIn.Include_Vars": { 720 | "prefix": [ 721 | "ansible.builtin.include_vars", 722 | "include_vars" 723 | ], 724 | "body": [ 725 | "- name: ${1:Description}, loading dynamically at run-time", 726 | " ansible.builtin.include_vars: ", 727 | " file: \"${2:file_name}\"", 728 | "$0" 729 | ], 730 | "description": "Used for Ansible IncludeVars Module to load variables Dynamically at runtime", 731 | "scope": "ansible" 732 | }, 733 | "Ansible.BuiltIn.IpTables": { 734 | "prefix": [ 735 | "ansible.builtin.iptables", 736 | "iptables" 737 | ], 738 | "body": [ 739 | "- name: ${1:Description}", 740 | " ansible.builtin.iptables:", 741 | " action: ${2|append,insert|}", 742 | " chain: '${3|INPUT,FORWARD,OUTPUT,PREROUTING,POSTROUTING,SECMARK,CONNSECMARK|}'", 743 | " comment: ${4:comment}", 744 | " destination: ${5:destination}", 745 | " destination_port: ${6:destination_port}", 746 | " dst_range: ${7:destination_range}", 747 | " flush: ${8|true,false|}", 748 | " icmp_type: ${9:icmp_type}", 749 | " in_interface: ${10:in_interface}", 750 | " ip_version: ${11|ipv4,ipv6|}", 751 | " jump: ${12:jump}", 752 | " out_interface: ${13:out_interface}", 753 | " policy: ${14|ACCEPT,DROP,QUEUE,RETURN|}", 754 | " protocol: ${15|tcp,udp,udplite,icmp,ipv6-icmp,icmpv6,esp,ah,sctp,all|}", 755 | " source: ${16:source}", 756 | " source_port: ${17:source_port}", 757 | " source_range: ${18:source_range}", 758 | " state: ${19|present,absent|}", 759 | " table: ${20|filter,nat,mangle,raw,security|}", 760 | " to_destination: ${21:to_destination}", 761 | " to_ports: ${22:to_ports}", 762 | " to_source: ${23:to_source}", 763 | "$0" 764 | ], 765 | "description": "Used for Ansible IPTables Module to make/change IP Tables rules", 766 | "scope": "ansible" 767 | }, 768 | "Ansible.BuiltIn.LineInFile": { 769 | "prefix": [ 770 | "ansible.builtin.lineinfile", 771 | "lineinfile" 772 | ], 773 | "body": [ 774 | "- name: ${1:Description}", 775 | " ansible.builtin.lineinfile:", 776 | " path: ${2:dest_path}", 777 | " state: ${3|present,absent|}", 778 | " line: \"${4:myline}\"", 779 | " create: ${5|true,false|}${6:", 780 | " owner: \"${7:owner}\"}${8:", 781 | " group: \"${9:${7:owner}}\"}${10:", 782 | " mode: \"${11:0700}\"}", 783 | "$0" 784 | ], 785 | "description": "Used for Ansible LineInFile Module to add a single line to a file", 786 | "scope": "ansible" 787 | }, 788 | "Ansible.BuiltIn.Known_Hosts": { 789 | "prefix": [ 790 | "ansible.builtin.known_hosts", 791 | "known_hosts" 792 | ], 793 | "body": [ 794 | "- name: ${1:Description}", 795 | " ansible.builtin.known_hosts:", 796 | " name: \"${2:host_to_add_or_remove}\"", 797 | " state: ${3|present,absent|}${4:", 798 | " key: \"${5:ssh_public_host_key_string}\"}${6:", 799 | " hash_host: ${7|yes,no|}}${8:", 800 | " path: \"${9:known_hosts_file_path}\"}", 801 | "$0" 802 | ], 803 | "description": "Used for Ansible known_hosts", 804 | "scope": "ansible" 805 | }, 806 | "Ansible.BuiltIn.Meta": { 807 | "prefix": [ 808 | "ansible.builtin.meta", 809 | "meta" 810 | ], 811 | "body": [ 812 | "- name: ${1:Description}", 813 | " ansible.builtin.meta: ${2:|clear_facts,clear_host_errors,end_host,end_play,flush_handlers,noop,refresh_inventory,reset_connection,end_batch|}", 814 | "$0" 815 | ], 816 | "description": "Used for Ansible Meta to run internal functions", 817 | "scope": "ansible" 818 | }, 819 | "Ansible.BuiltIn.Package": { 820 | "prefix": [ 821 | "ansible.builtin.package", 822 | "package" 823 | ], 824 | "body": [ 825 | "- name: ${1:Description}", 826 | " ansible.builtin.package:", 827 | " name:", 828 | " - ${2:package_to_manage}", 829 | " state: ${3|present,absent|}", 830 | " register: apt_status", 831 | " until: apt_status is success", 832 | " delay: 6", 833 | " retries: 10", 834 | "$0" 835 | ], 836 | "description": "Used for Ansible Package generic Package Manager", 837 | "scope": "ansible" 838 | }, 839 | "Ansible.BuiltIn.Package_Facts": { 840 | "prefix": [ 841 | "ansible.builtin.package_facts", 842 | "package_facts" 843 | ], 844 | "body": [ 845 | "- name: ${1:Description}", 846 | " ansible.builtin.package_facts:", 847 | " manager: auto # puts results in ansible_facts.packages", 848 | "$0" 849 | ], 850 | "description": "Used for Ansible Package Facts Module", 851 | "scope": "ansible" 852 | }, 853 | "Ansible.BuiltIn.Pause_ForInput": { 854 | "prefix": [ 855 | "ansible.builtin.pause", 856 | "pause_foruser" 857 | ], 858 | "body": [ 859 | "- name: Waiting for User to press Enter", 860 | " ansible.builtin.pause:", 861 | " prompt: 'Waiting for User to press Enter'", 862 | "$0" 863 | ], 864 | "description": "Used for Ansible Pause Module to wait for user input", 865 | "scope": "ansible" 866 | }, 867 | "Ansible.BuiltIn.Pause_ForTime": { 868 | "prefix": [ 869 | "ansible.builtin.pause", 870 | "pause_fortime" 871 | ], 872 | "body": [ 873 | "- name: Waiting for ${1} ${2}", 874 | " ansible.builtin.pause:", 875 | " ${2|minutes,seconds|}: ${1:amount_to_wait}", 876 | "$0" 877 | ], 878 | "description": "Used for Ansible Pause Module to wait for a given block of time", 879 | "scope": "ansible" 880 | }, 881 | "Ansible.BuiltIn.Pip_Install": { 882 | "prefix": [ 883 | "ansible.builtin.pip", 884 | "pip_install" 885 | ], 886 | "body": [ 887 | "- name: ${1:Description}", 888 | " ansible.builtin.pip:", 889 | " state: ${2|latest,present,forcereinstall,absent|}${3:", 890 | " chdir: \"${4:cd_dir}\"}", 891 | " name:", 892 | " - ${5:package_name}", 893 | "$0" 894 | ], 895 | "description": "Used for Ansible Pip to install specific packages", 896 | "scope": "ansible" 897 | }, 898 | "Ansible.BuiltIn.Pip_Requirements": { 899 | "prefix": [ 900 | "ansible.builtin.pip", 901 | "pip_requirements" 902 | ], 903 | "body": [ 904 | "- name: ${1:Description}", 905 | " ansible.builtin.pip:", 906 | " requirements: \"${2:requirements_location}\"${3:", 907 | " chdir: \"${4:cd_dir}\"}${5:", 908 | " virtualenv: \"${6:virtenv_dir}\"}", 909 | "$0" 910 | ], 911 | "description": "Used for Ansible Pip to manage packages and virtual environments", 912 | "scope": "ansible" 913 | }, 914 | "Ansible.BuiltIn.Raw": { 915 | "prefix": [ 916 | "ansible.builtin.raw", 917 | "raw" 918 | ], 919 | "body": [ 920 | "- name: ${1:Description}", 921 | " ansible.builtin.raw: ${2:commmand_to_run}", 922 | "$0" 923 | ], 924 | "description": "Used for Ansible Raw command to run straight from SSH", 925 | "scope": "ansible" 926 | }, 927 | "Ansible.BuiltIn.Reboot": { 928 | "prefix": [ 929 | "ansible.builtin.reboot", 930 | "reboot" 931 | ], 932 | "body": [ 933 | "- name: ${1:Description}", 934 | " ansible.builtin.reboot:${2:", 935 | " reboot_timeout: \"${3:seconds_to_wait}\"}}", 936 | "$0" 937 | ], 938 | "description": "Used for Ansible Reboot", 939 | "scope": "ansible" 940 | }, 941 | "Ansible.BuiltIn.Replace": { 942 | "prefix": [ 943 | "ansible.builtin.replace", 944 | "replace" 945 | ], 946 | "body": [ 947 | "- name: ${1:Description}", 948 | " ansible.builtin.replace:", 949 | " path: \"${2:path_to_file}\"", 950 | " regexp: \"${3:text_to_find}\"", 951 | " replace: \"${4:text_do_add}\"${5:", 952 | " before: \"${6:text_to_stop_search_at}\"}${7:", 953 | " after: \"${8:text_to_begin_search_at}\"}${9:", 954 | " owner: \"${10:file_owner}\"}${11:", 955 | " group: \"${12:${10:file_owner}}\"}${13:", 956 | " mode: ${14:'0770'}}", 957 | "$0" 958 | ], 959 | "description": "Used for Ansible Replace to change the contents of a file", 960 | "scope": "ansible" 961 | }, 962 | "Ansible.BuiltIn.RpmKey": { 963 | "prefix": [ 964 | "ansible.builtin.rpm_key", 965 | "rpm_key" 966 | ], 967 | "body": [ 968 | "- name: ${1:Description}", 969 | " ansible.builtin.rpm_key:", 970 | " key: \"${2:key_url}\"", 971 | " state: ${3|present,absent|}", 972 | " validate_certs: ${4|true,false|}", 973 | "$0" 974 | ], 975 | "description": "Used for Ansible RPM_Key Module to add a key to the keyring", 976 | "scope": "ansible" 977 | }, 978 | "Ansible.BuiltIn.Scripts": { 979 | "prefix": [ 980 | "ansible.builtin.scripts", 981 | "scripts" 982 | ], 983 | "body": [ 984 | "- name: ${1:Description}", 985 | " ansible.builtin.scripts:", 986 | " cmd: ${2:path_to_local_script}${3:", 987 | " executables: ${4:remote_executable_to_use}}${5:", 988 | " chdir: \"${6:dir_on_remote_node}\"}${7:", 989 | " creates: \"${8:if_present_dont_run}\"}${9:", 990 | " removes: \"${10:if_missing_dont_run}\"}", 991 | "$0" 992 | ], 993 | "description": "Used for Ansible scripts module to run a script on remote host", 994 | "scope": "ansible" 995 | }, 996 | "Ansible.BuiltIn.Service": { 997 | "prefix": [ 998 | "ansible.builtin.service", 999 | "service" 1000 | ], 1001 | "body": [ 1002 | "- name: Ensure ${1:servicename} is ${2|started,stopped,restarted,reloaded|}", 1003 | " ansible.builtin.service:", 1004 | " name: ${1:servicename}", 1005 | " state: ${2}", 1006 | " enabled: ${3|true,false|}", 1007 | "$0" 1008 | ], 1009 | "description": "Used for Ansible Services Module", 1010 | "scope": "ansible" 1011 | }, 1012 | "Ansible.BuiltIn.Service_Facts": { 1013 | "prefix": [ 1014 | "ansible.builtin.service_facts", 1015 | "service_facts" 1016 | ], 1017 | "body": [ 1018 | "- name: ${1:Description}", 1019 | " ansible.builtin.service_facts:", 1020 | " # Returns results in ansible_facts.services", 1021 | "$0" 1022 | ], 1023 | "description": "Used for Ansible Service Facts", 1024 | "scope": "ansible" 1025 | }, 1026 | "Ansible.BuiltIn.SetFact": { 1027 | "prefix": [ 1028 | "ansible.builtin.set_fact", 1029 | "set_fact" 1030 | ], 1031 | "body": [ 1032 | "- name: ${1:Description}", 1033 | " ansible.builtin.set_fact:", 1034 | " ${2:my_fact_name}: \"${3}\"", 1035 | "$0" 1036 | ], 1037 | "description": "Used for Ansible Set Fact Module", 1038 | "scope": "ansible" 1039 | }, 1040 | "Ansible.BuiltIn.SetStats": { 1041 | "prefix": [ 1042 | "ansible.builtin.set_stats", 1043 | "set_stats" 1044 | ], 1045 | "body": [ 1046 | "- name: ${1:Description}", 1047 | " ansible.builtin.set_stats:", 1048 | " aggregate: ${2|true,false|}", 1049 | " per_host: ${3|false,true|}", 1050 | " data:", 1051 | " ${4:Datakey}: ${5:Datavalue}", 1052 | "$0" 1053 | ], 1054 | "description": "Used for Ansible Set Stats Task", 1055 | "scope": "ansible" 1056 | }, 1057 | "Ansible.BuiltIn.Setup": { 1058 | "prefix": [ 1059 | "ansible.builtin.setup", 1060 | "setup" 1061 | ], 1062 | "body": [ 1063 | "- name: ${1:Description}", 1064 | " ansible.builtin.setup:${2:", 1065 | " gather_subset:", 1066 | " - ${3|'!,'|}${4|all,min,hardware,network,virtual,ohai,facter|}'}${5:", 1067 | " filter:", 1068 | " - '${6:facts_to_collect}'}${7:", 1069 | " gather_timeout: ${8:timeout_in_seconds}}", 1070 | "$0" 1071 | ], 1072 | "description": "Used for Ansible setup", 1073 | "scope": "ansible" 1074 | }, 1075 | "Ansible.BuiltIn.Shell": { 1076 | "prefix": [ 1077 | "ansible.builtin.shell", 1078 | "shell" 1079 | ], 1080 | "body": [ 1081 | "- name: ${1:Description}", 1082 | " ansible.builtin.shell:", 1083 | " cmd: \"${2}\"${3:", 1084 | " chdir: \"${4}\"}${5:", 1085 | " creates: \"${6:file_if_present_dont_run}\"}${7:", 1086 | " removes: \"${8:file_if_present_do_run}\"}", 1087 | "$0" 1088 | ], 1089 | "description": "Used for Ansible Shell Module", 1090 | "scope": "ansible" 1091 | }, 1092 | "Ansible.BuiltIn.Slurp": { 1093 | "prefix": [ 1094 | "ansible.builtin.slurp", 1095 | "slurp" 1096 | ], 1097 | "body": [ 1098 | "- name: ${1:Description}", 1099 | " ansible.builtin.slurp:", 1100 | " src: \"${2:path_to_file}\"", 1101 | " register: ${3:file_contents_var}", 1102 | " # Contents at \"${3}['content'] | b64decode\"", 1103 | "$0" 1104 | ], 1105 | "description": "Used for Ansible Slurp Module to read a file on remote host into a variable", 1106 | "scope": "ansible" 1107 | }, 1108 | "Ansible.BuiltIn.Stat": { 1109 | "prefix": [ 1110 | "ansible.builtin.stat", 1111 | "file_exists", 1112 | "stat" 1113 | ], 1114 | "body": [ 1115 | "- name: ${1:Description}", 1116 | " ansible.builtin.stat:", 1117 | " path: \"${2:path_to_file}\"", 1118 | " register: ${3:variable_for_file_status}", 1119 | " #${3:variable_for_file_status}.stat.exists to check file existance", 1120 | "$0" 1121 | ], 1122 | "description": "Used for Ansible Stat Module to get File details", 1123 | "scope": "ansible" 1124 | }, 1125 | "Ansible.BuiltIn.Subversion": { 1126 | "prefix": [ 1127 | "ansible.builtin.subversion", 1128 | "subversion" 1129 | ], 1130 | "body": [ 1131 | "- name: ${1:Description}", 1132 | " ansible.builtin.subversion:", 1133 | " repo: \"${2:url_to_repo}\"", 1134 | " dest: \"${3:path_to_destination}\"${4:", 1135 | " username: \"${5:my_username}\"}${6:", 1136 | " password: \"${7:my_password}\"}${8:", 1137 | " checkout: ${9|true,false|}}${10:", 1138 | " executable: \"${11:path_to_subversion_exe}\"}${12:", 1139 | " export: ${13|true,false|}}${14:", 1140 | " force: ${15|true,false|}}${16:", 1141 | " in_place: ${17|true,false|}}${18:", 1142 | " revision: \"${19:HEAD}\"}${20:", 1143 | " switch: ${21|true,false|}}${22:", 1144 | " update: ${23|true,false|}}${24:", 1145 | " validate_certs: ${25|true,false|}}", 1146 | "$0" 1147 | ], 1148 | "description": "Used for Ansible subversion", 1149 | "scope": "ansible" 1150 | }, 1151 | "Ansible.BuiltIn.SystemD": { 1152 | "prefix": [ 1153 | "ansible.builtin.systemd", 1154 | "systemd" 1155 | ], 1156 | "body": [ 1157 | "- name: ${1:Description}", 1158 | " ansible.builtin.systemd:", 1159 | " name: \"${2:service_to_change}\"", 1160 | " state: ${3|started,stopped,reloaded,restarted|}${4:", 1161 | " enabled: ${5|true,false|}}${6:", 1162 | " masked: ${7|true,false|}}${8:", 1163 | " force: ${9|true,false|}}${10:", 1164 | " daemon_reload: ${11|true,false|}}${12:", 1165 | " scope: ${13|system,user,global|}}", 1166 | "$0" 1167 | ], 1168 | "description": "Used for Ansible systemd to manage services, timers, etc", 1169 | "scope": "ansible" 1170 | }, 1171 | "Ansible.BuiltIn.SysVInit": { 1172 | "prefix": [ 1173 | "ansible.builtin.sysvinit", 1174 | "sysvinit" 1175 | ], 1176 | "body": [ 1177 | "- name: ${1:Description}", 1178 | " ansible.builtin.sysvinit:", 1179 | " name: \"${2:name_of_service}\"${3:", 1180 | " state: ${4|started,stopped,restarted,reloaded|}}${5:", 1181 | " enabled: ${6|true,false|}}${7:", 1182 | " runlevels:", 1183 | " - ${8|1 # Single User,2 # Multi-User,3 # Multi-User with Network,4 # User Defined,5 # Level 3 plus Display (X)|}${9:", 1184 | " - ${10|1 # Single User,2 # Multi-User,3 # Multi-User with Network,4 # User Defined,5 # Level 3 plus Display (X)|}}}", 1185 | "$0" 1186 | ], 1187 | "description": "Used for Ansible sysvinit to control services on a host", 1188 | "scope": "ansible" 1189 | }, 1190 | "Ansible.Builtin.Tempfile": { 1191 | "prefix": [ 1192 | "ansible.builtin.tempfile", 1193 | "tempfile" 1194 | ], 1195 | "body": [ 1196 | "- name: ${1:Description}", 1197 | " ansible.builtin.tempfile:${2:", 1198 | " path: \"${3:file_system_path_for_temp_dir}\"}${4:", 1199 | " prefix: \"${5:prefix_of_file_or_dir_made}\"}${6:", 1200 | " suffix: \"${7:suffix_of_file_or_dir_made}\"}", 1201 | " state: ${8|file,directory|}", 1202 | " register: ${9:tempfile}_${8}", 1203 | "$0" 1204 | ], 1205 | "description": "Used for Ansible Tempfile module to make temporary files or directories for use in plays", 1206 | "scope": "ansible" 1207 | }, 1208 | "Ansible.BuiltIn.Template": { 1209 | "prefix": [ 1210 | "ansible.builtin.template", 1211 | "template" 1212 | ], 1213 | "body": [ 1214 | "- name: ${1:Description}", 1215 | " ansible.builtin.template:", 1216 | " src: ${2:local_source}", 1217 | " dest: ${3:remote_destination}", 1218 | " force: ${4|true,false|}", 1219 | // Ansible-Lint hates when this isn't set 1220 | " mode: ${6:'0770'}", 1221 | "$0" 1222 | ], 1223 | "description": "Used for Ansible Temmplate Module", 1224 | "scope": "ansible" 1225 | }, 1226 | "Ansible.BuiltIn.Unarchive": { 1227 | "prefix": [ 1228 | "ansible.builtin.unarchive", 1229 | "unarchive" 1230 | ], 1231 | "body": [ 1232 | "- name: ${1:Description}", 1233 | " ansible.builtin.unarchive:", 1234 | " src: \"${2:source_path}\"", 1235 | " dest: \"${3:destination_path}\"", 1236 | " remote_src: ${4|true,false|}${5:", 1237 | " creates: \"${6:created_file}\"}", 1238 | "$0" 1239 | ], 1240 | "description": "Used for Ansible Unarchive module to unzip archives", 1241 | "scope": "ansible" 1242 | }, 1243 | "Ansible.Builin.URI": { 1244 | "prefix": [ 1245 | "ansible.builtin.uri", 1246 | "uri" 1247 | ], 1248 | "body": [ 1249 | "- name: ${1:Description}", 1250 | " ansible.builtin.uri:", 1251 | " url: \"${2|http://,https://|}${3:url_host_domain_port_path}\"", 1252 | " method: \"${4|GET,POST,PUT,DELETE,CONNECT,HEAD,OPTIONS,TRACE|}\"", 1253 | " ${5:force_basic_auth: ${6|true,false|}}", 1254 | " ${7:url_username: \"${8:username_for_auth}\"}", 1255 | " ${9:url_password: \"${10:password_for_auth}\"}", 1256 | " ${11:attributes: \"${12:file_attributes}\"}", 1257 | " ${13:body: \"${14:web_request_body}\"}", 1258 | " ${15:body_format: \"${16|raw,form-urlencoded,json,form-multipart|}\"}", 1259 | " ${17:ca_path: \"${18:ca_pem_path}\"}", 1260 | " ${19:client_cert : \"${20:client_pem_path}\"}", 1261 | " ${21:client_key: \"${22:client_key_pem_path}\"}", 1262 | " ${23:creates: \"${24:created_file_path}\"}", 1263 | " ${25:removes: \"${26:file_thats_removed}\"}", 1264 | " ${27:src: \"${28:path_to_remote_file}\"}", 1265 | " ${29:dest: \"${30:path_to_download_to}\"}", 1266 | " ${31:follow_redirects: ${32|safe,all,no,none,urllib2,yes|}}", 1267 | " ${33:force: ${34|true,false|}}", 1268 | " ${35:owner: \"${36:owner}\"}", 1269 | " ${37:group: \"${38:${36:owner}}\"}", 1270 | " ${39:mode: \"${40:0700}\"}", 1271 | " ${41:headers:", 1272 | " - ${42:HEADER1}}", 1273 | " ${43:http_agent: \"${44:http_agent_str}\"}", 1274 | " ${45:remote_src: ${46|true,false|}}", 1275 | " ${47:return_content: ${48|true,false|}}", 1276 | " ${49:status_code: ${50:[200, other_success_codes]}}", 1277 | " ${51:timeout: ${52:timeout_in_seconds}}", 1278 | " ${53:unix_socket: \"${54:connection_socket_path}\"}", 1279 | " ${55:unsafe_writes: ${56|true,false|}}", 1280 | " ${57:use_gssapi: ${58|true,false|}}", 1281 | " ${59:use_proxy: ${60|true,false|}}", 1282 | " ${61:validate_certs: ${62|true,false|}}", 1283 | "$0" 1284 | ], 1285 | "description": "Used for Ansible URI module to make a web request", 1286 | "scope": "ansible" 1287 | }, 1288 | "Ansible.BuiltIn.User": { 1289 | "prefix": [ 1290 | "ansible.builtin.user", 1291 | "user" 1292 | ], 1293 | "body": [ 1294 | "- name: ${1:Description} ${2:Username}", 1295 | " ansible.builtin.user:", 1296 | " name: ${2}", 1297 | " commment: ${1}", 1298 | " state: ${3|present,absent|}", 1299 | " append: ${4|false,true|} # Append Groups to user, instead of overwrite", 1300 | " create_home: ${5|true,false|}", 1301 | " groups: ${6:groups}", 1302 | " system: ${7|false,true|}", 1303 | "$0" 1304 | ], 1305 | "description": "Used for Ansible User Module", 1306 | "scope": "ansible" 1307 | }, 1308 | "Ansible.BuiltIn.Wait_For_Connection": { 1309 | "prefix": [ 1310 | "ansible.builtin.wait_for_connection", 1311 | "wait_for_connection" 1312 | ], 1313 | "body": [ 1314 | "- name: ${1:Description}", 1315 | " ansible.builtin.wait_for_connection:${2:", 1316 | " connect_timeout: ${3:seconds_to_wait_before_retrying}}${4:", 1317 | " delay: ${5:seconds_to_wait_before_trying_to_connect}}${6:", 1318 | " sleep: ${7:seconds_to_wait_between_checks}}${8:", 1319 | " timeout: ${9:max_seconds_to_wait_before_marking_task_failed}}", 1320 | "$0" 1321 | ], 1322 | "description": "Used for Ansible Wait for Connection Module to pause play execution until host is available", 1323 | "scope": "ansible" 1324 | }, 1325 | "Ansible.BuiltIn.WaitForFile": { 1326 | "prefix": [ 1327 | "ansible.builtin.wait_for", 1328 | "wait_for" 1329 | ], 1330 | "body": [ 1331 | "- name: ${1:Description}", 1332 | " ansible.builtin.wait_for:", 1333 | " path: ${2:filiename}", 1334 | " state: ${3|present,absent|}", 1335 | " delay: ${5:delayInSeconds}", 1336 | "$0" 1337 | ], 1338 | "description": "Used for Ansible Wait_for Module", 1339 | "scope": "ansible" 1340 | }, 1341 | "Ansible.BuiltIn.Yum": { 1342 | "prefix": [ 1343 | "ansible.builtin.yum", 1344 | "yum" 1345 | ], 1346 | "body": [ 1347 | "- name: ${1:Description}", 1348 | " ansible.builtin.yum:", 1349 | " name:", 1350 | " - ${2:package_name}", 1351 | " state: ${3|present,absent,latest,installed,removed|}${4:", 1352 | " disable_gpg_check: ${5|true,false|}}${6:", 1353 | " update_cache: ${7|true,false|}}${8:", 1354 | " validate_certs: ${24|true,false|}}", 1355 | "$0" 1356 | ], 1357 | "description": "Used for Ansible Yum to install packages with Yum", 1358 | "scope": "ansible" 1359 | }, 1360 | "Ansible.BuiltIn.Yum_Repository": { 1361 | "prefix": [ 1362 | "ansible.builtin.yum_repository", 1363 | "yum_repository" 1364 | ], 1365 | "body": [ 1366 | "- name: Add Repository for ${1:RepoName}", 1367 | " ansible.builtin.yum_repository:", 1368 | " name: ${1:RepoName}", 1369 | " description: ${2}", 1370 | " baseurl: ${3:BaseUrl}", 1371 | " state: ${4|present,absent|}", 1372 | " enabled: ${5|true,false|}", 1373 | "$0" 1374 | ], 1375 | "description": "Used for Ansible Yum Repository Module", 1376 | "scope": "ansible" 1377 | }, 1378 | } -------------------------------------------------------------------------------- /ansible.netcommon.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Ansible.Netcommon.Telnet": { 3 | "prefix": [ 4 | "ansible.netcommon.telnet", 5 | "telnet" 6 | ], 7 | "body": [ 8 | "- name: ${1:Description}", 9 | " ansible.netcommon.telnet:${2:", 10 | " user: \"${3:user_name}\"}${4:", 11 | " password: \"${5:password_val}\"}${6:", 12 | " login_prompt: \"${7:expected_prompt}\"}${8:", 13 | " host: \"${9:hostname_to_connect}\"}${10:", 14 | " prompts:", 15 | " - ${11:Prompt_before_sending_command}}${12:", 16 | " command:", 17 | " - ${13:Command_to_run}}", 18 | "$0" 19 | ], 20 | "description": "Used for Ansible Telnet Module", 21 | "scope": "ansible" 22 | }, 23 | } -------------------------------------------------------------------------------- /ansible.posix.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Ansible.Posix.Mount": { 3 | "prefix": [ 4 | "ansible.posix.mount", 5 | "mount" 6 | ], 7 | "body": [ 8 | "- name: ${1:Description}", 9 | " ansible.posix.mount:", 10 | " fstype: \"${2:file_system_type}\"", 11 | " opts: \"${3:file_system_options}\"", 12 | " path: \"${4:file_system_path}\"", 13 | " src: \"${5:file_system_source}\"", 14 | " state: \"${6|present,absent,mounted,unmounted,remounted|}\"", 15 | "$0" 16 | ], 17 | "description": "Used for Ansible Mount Module to add mount points", 18 | "scope": "ansible" 19 | }, 20 | } -------------------------------------------------------------------------------- /ansible.utils.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Ansible.Utils.Fact_Diff": { 3 | "prefix": [ 4 | "ansible.utils.fact_diff", 5 | "fact_diff" 6 | ], 7 | "body": [ 8 | "- name: ${1:Description}", 9 | " ansible.utils.fact_diff:", 10 | " before: \"${2:first_fact_to_compare}\"", 11 | " after: \"${3:second_fact_to_compare}\"", 12 | "$0" 13 | ], 14 | "description": "Used for Ansible fact_diff", 15 | "scope": "ansible" 16 | }, 17 | "Ansible.Utils.Update_Fact": { 18 | "prefix": [ 19 | "ansible.utils.update_fact", 20 | "update_fact" 21 | ], 22 | "body": [ 23 | "- name: ${1:Description}", 24 | " ansible.utils.update_fact:", 25 | " updates:", 26 | " - path: ${2:variable_path_to_update}", 27 | " value: ${3:value_to_add}", 28 | " register: ${4:new_changed_variable_name}", 29 | "$0" 30 | ], 31 | "description": "Used for Ansible update_fact", 32 | "scope": "ansible" 33 | }, 34 | } -------------------------------------------------------------------------------- /community.dns.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Community.DNS.WaitForText": { 3 | "prefix": [ 4 | "community.dns.wait_for_txt", 5 | "wait_for_txt" 6 | ], 7 | "body": [ 8 | "- name: ${1:Description}", 9 | " community.dns.wait_for_txt:", 10 | " records:", 11 | " - name: \"${2:domain_value}\"", 12 | " values: \"${3:value_to_wait_for}\"", 13 | " mode: \"${4|subset,superset,superset_not_empty,equals,equals_ordered|}\"", 14 | "$0" 15 | ], 16 | "description": "Used for Ansible Wait for Text for DNS records", 17 | "scope": "ansible" 18 | }, 19 | } -------------------------------------------------------------------------------- /community.general.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Community.General.Alternatives": { 3 | "prefix": [ 4 | "community.general.alternatives", 5 | "alternatives" 6 | ], 7 | "body": [ 8 | "- name: ${1:Description}", 9 | " community.general.alternatives:", 10 | " name: \"${2:generic_link_name}\"", 11 | " path: \"${3:path_to_real_executable}\"${4:", 12 | " link: \"${5:path_to_symllink_for_real_executable}\"}", 13 | "$0" 14 | ], 15 | "description": "Used for Ansible alternatives", 16 | "scope": "ansible" 17 | }, 18 | "Commmunity.General.Archive": { 19 | "prefix": [ 20 | "community.general.archive" 21 | ], 22 | "body": [ 23 | "- name: ${1:Description}", 24 | " community.general.archive:", 25 | " dest: \"${2:path_to_save_archive_to}\"", 26 | " force_archive: ${3|true,false|}", 27 | " format: ${4|zip,gz,bz2,tar,zx|}", 28 | " owner: \"${5:owner}\"", 29 | " group: \"${6:group}\"", 30 | " mode: \"${7:0700}\"", 31 | " path:", 32 | " - ${8:file_or_dir_to_archive}", 33 | " ${9:exclude_path}", 34 | " ${20:- path_to_exclude}}", 35 | "$0" 36 | ], 37 | "description": "Used for Ansible Archive Module to package files together", 38 | "scope": "ansible" 39 | }, 40 | "Commmunity.General.Discord_FromEnv": { 41 | "prefix": [ 42 | "community.general.discord" 43 | ], 44 | "body": [ 45 | "- name: ${1:Description}", 46 | " community.general.discord:", 47 | " webhook_id: {{ lookup('env', 'DISCORD_ID') }}", 48 | " webhook_token: {{ lookup('env', 'DISCORD_TOKEN') }}", 49 | " content: \"${2:my_message_to_discord}\"", 50 | "$0" 51 | ], 52 | "description": "Used for Ansible Discord Integration", 53 | "scope": "ansible" 54 | }, 55 | "Community.General.DjangoManage": { 56 | "prefix": [ 57 | "community.general.django_manage" 58 | ], 59 | "body": [ 60 | "- name: ${1:Description}", 61 | " community.general.django_manage:", 62 | " command: \"${2|cleanup,collectstatic,createcachetable,flush,loaddata,migrate,syncdb,test,validate|}\"", 63 | " project_path: \"${4:project_dir}\"", 64 | " ${5:virtualenv: \"${6:virtenv_path}\"}", 65 | " ${7:database: \"${8:db_name}\"}", 66 | "$0" 67 | ], 68 | "description": "Used for Ansible Django Manage to do Django functions", 69 | "scope": "ansible" 70 | }, 71 | "Community.General.Modprobe": { 72 | "prefix": [ 73 | "community.general.modprobe" 74 | ], 75 | "body": [ 76 | "- name: ${1:Description}", 77 | " community.general.modprobe:", 78 | " name: \"${2:kernel_module}\"", 79 | " state: ${3|present,absent|}", 80 | " ${4:params: \"${5:module_params}\"}", 81 | "$0" 82 | ], 83 | "description": "Used for Ansible ModProbe Module", 84 | "scope": "ansible" 85 | }, 86 | "Community.General.Snap": { 87 | "prefix": [ 88 | "community.general.snap" 89 | ], 90 | "body": [ 91 | "- name: ${1:Description}", 92 | " community.general.snap:", 93 | " name: \"${2:snap_to_add}\"", 94 | " state: ${3|present,absent,enabled,disabled|}", 95 | " classic: ${4|true,false|}", 96 | " ${5:channel: \"${6:release_version}\"}", 97 | "$0" 98 | ], 99 | "description": "Used for Ansible Snap Module", 100 | "scope": "ansible" 101 | }, 102 | // Originally I was going to make this selectable, but there are 608 Timezones... so no. 103 | "Commmunity.General.Timezone": { 104 | "prefix": [ 105 | "community.general.timezone", 106 | "timezone" 107 | ], 108 | "body": [ 109 | "- name: ${1:Description}", 110 | " community.general.timezone:", 111 | " name: ${2:America/New_York}", 112 | "$0" 113 | ], 114 | "description": "Used for Ansible Timezone Module to set host timezone", 115 | "scope": "ansible" 116 | }, 117 | "Community.General.Zypper": { 118 | "prefix": [ 119 | "community.general.zypper", 120 | "zypper" 121 | ], 122 | "body": [ 123 | "- name: ${1:Description}", 124 | " community.general.zypper:", 125 | " name:", 126 | " - ${2:package_name}", 127 | " state: ${3|present,absent,latest,installed,removed|}", 128 | " disable_gpg_check: ${5|true,false|}", 129 | " update_cache: ${7|true,false|}", 130 | " validate_certs: ${8|true,false|}", 131 | "$0" 132 | ], 133 | "description": "Used for Ansible Community General Zypper module to manage packages with Zypper", 134 | "scope": "ansible" 135 | }, 136 | "Community.General.Zypper_Repository": { 137 | "prefix": [ 138 | "community.general.zypper_repository", 139 | "zypper_repository" 140 | ], 141 | "body": [ 142 | "- name: Add Repository for ${1:RepoName}", 143 | " community.general.zypper_repository:", 144 | " name: ${1:RepoName}", 145 | " description: ${2:Description}", 146 | " repo: ${3:RepoUrl}", 147 | " state: ${4|present,absent|}", 148 | " enabled: ${5|true,false|}", 149 | " autorefresh: ${6|true,false|}", 150 | " auto_import_keys: ${7|true,false|}", 151 | "$0" 152 | ], 153 | "description": "Used for Ansible Community General Zypper module to manage repositories with Zypper", 154 | "scope": "ansible" 155 | }, 156 | } -------------------------------------------------------------------------------- /community.postgresql.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Community.Postgresql.Postgresql_db": { 3 | "prefix": [ 4 | "community.postgresql.postgresql_db", 5 | "postgresql_db" 6 | ], 7 | "body": [ 8 | "- name: ${1:Description}", 9 | " community.postgresql.postgresql_db:", 10 | " name: \"${2:database_name}\"", 11 | " ${3:owner: \"${4:owner_name}\"}", 12 | " ${5:template: \"${6:template_name}\"}", 13 | " ${7:encoding: \"${8:UTF8}\"}", 14 | "$0" 15 | ], 16 | "description": "Used for Ansible Postgresql_db Module to make a new Postgresql Database", 17 | "scope": "ansible" 18 | }, 19 | "Community.Postgresql.Postgresql_user": { 20 | "prefix": [ 21 | "community.postgresql.postgresql_user", 22 | "postgresql_user" 23 | ], 24 | "body": [ 25 | "- name: ${1:Description}", 26 | " community.postgresql.postgresql_user:", 27 | " name: \"${2:user_name}\"", 28 | " state: \"${3|present,absent|}\"", 29 | " role_attr_flags: \"${4:CREATEDB}\"", 30 | "$0" 31 | ], 32 | "description": "Used for Ansible Postgresql User module to make a new user", 33 | "scope": "ansible" 34 | }, 35 | } -------------------------------------------------------------------------------- /container.podman.code-snippets: -------------------------------------------------------------------------------- 1 | { 2 | "Containers.Podman.Podman_Login": { 3 | "prefix": [ 4 | "containers.podman.podman_login", 5 | "podman_login" 6 | ], 7 | "body": [ 8 | "- name: ${1:Description}", 9 | " containers.podman.podman_login:", 10 | " username: ${2:user_name}", 11 | " password: \"${3:registry_password}\"", 12 | " registry: ${4:container_registry}", 13 | "$0" 14 | ], 15 | "description": "Used for Ansible Podman Container module to log in to an image registry", 16 | "scope": "ansible" 17 | }, 18 | "Containers.Podman.Podman_Container": { 19 | "prefix": [ 20 | "containers.podman.podman_container", 21 | "podman_container" 22 | ], 23 | "body": [ 24 | "- name: ${1:Description}", 25 | " containers.podman.podman_container:", 26 | " name: ${2:container_name}", 27 | " image: ${3:container_image}", 28 | " authfile: \"${4:XDG_RUNTIME_DIR}/containers/auth.json\"", 29 | " state: ${5|started,present,stopped,absent,created|}", 30 | " volume:", 31 | " - ${6:podman_container_volume}", 32 | " generate_systemd:", 33 | " path: \"${7:/path/to/unit/file}\"", 34 | " names: \"${8:/path/to/unit/file}\"", 35 | " new: ${9|true,false|}", 36 | " restart_policy: ${10|always,no,on-success,on-failure,on-abnormal,on-watchdog,on-abort|}", 37 | " time: ${11:stop_timeout}", 38 | "$0" 39 | ], 40 | "description": "Used for Ansible Podman Container module to manage container images", 41 | "scope": "ansible" 42 | }, 43 | "Containers.Podman.Podman_Image": { 44 | "prefix": [ 45 | "containers.podman.podman_image", 46 | "podman_image" 47 | ], 48 | "body": [ 49 | "- name: ${1:Description}", 50 | " containers.podman.podman_image:", 51 | " name: ${2:image_name}", 52 | " state: ${3|present,absent|}", 53 | "$0" 54 | ], 55 | "description": "Used for Ansible Podman Image module to pull/delete container images", 56 | "scope": "ansible" 57 | }, 58 | "Containers.Podman.Podman_Image_Build": { 59 | "prefix": [ 60 | "containers.podman.podman_image_build", 61 | "podman_image_build" 62 | ], 63 | "body": [ 64 | "- name: ${1:Description}", 65 | " containers.podman.podman_image:", 66 | " name: ${2:image_name}", 67 | " path: \"${3:/path/to/build/dir}\"", 68 | " build:", 69 | " format: ${4|docker,oci|}", 70 | "$0" 71 | ], 72 | "description": "Used for Ansible Podman Image module to build container images", 73 | "scope": "ansible" 74 | }, 75 | "Container.Podman.Podman_Containers": { 76 | "prefix": [ 77 | "container.podman.podman_containers", 78 | "podman_image_build" 79 | ], 80 | "body": [ 81 | "- name: ${1:Description}", 82 | " podman_containers:", 83 | " containers:", 84 | " - name: ${2:container_name}", 85 | " image: ${3:image_name}", 86 | " command: ${4:commands_run}", 87 | " - name: ${5:containers_name}", 88 | " image: ${6:image_name}", 89 | " command: ${7:commands_run}", 90 | " - name: ${8:containers_name}", 91 | " image: ${9:image_name}", 92 | " command: ${10:commands_run}", 93 | "$0" 94 | ], 95 | "description": "Used for Ansible Podman Containers module to work with multiple podman containers in one task", 96 | "scope": "ansible" 97 | }, 98 | } -------------------------------------------------------------------------------- /copy_snippets_global.ps1: -------------------------------------------------------------------------------- 1 | Param ( 2 | [switch] $Include_Helpers 3 | ) 4 | 5 | $CurrentUser = (Get-ChildItem Env:\USERNAME).Value 6 | $SnippetHelper = "snippet_helper.code-snippets" 7 | $SnippetDestPath = "C:\Users\$CurrentUser\AppData\Roaming\Code\User\snippets" 8 | 9 | Write-Output "Installing Snippets..." 10 | # Get all files from current folder with snippet extension 11 | $Snippets = Get-ChildItem -Path .\ | Where-Object {$_.Name -like '*.code-snippets'} 12 | 13 | foreach ($Snippet in $Snippets) 14 | { 15 | 16 | if ($Snippet.Name -ne $SnippetHelper) 17 | { 18 | # Copy Each file to C:\Users\CurrentUser\AppData\Roaming\Code\User\snippets with overwrite 19 | Copy-Item -Path $Snippet.Name -Destination $SnippetDestPath 20 | } 21 | 22 | if (($Include_Helpers -eq $True) -And ($Snippet.Name -eq $SnippetHelper)) 23 | { 24 | Copy-Item -Path $Snippet.Name -Destination $SnippetDestPath 25 | } 26 | } 27 | Write-Output "Install Complete." 28 | 29 | -------------------------------------------------------------------------------- /copy_snippets_global.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "$1" 4 | 5 | SNIPPET_HOME=~/.config/Code/User/snippets 6 | SNIPPET_HELPER_NAME=snippet_helper.code-snippets 7 | 8 | echo "Copying snippets to $SNIPPET_HOME..." 9 | 10 | for snippet_filename in ./*.code-snippets 11 | do 12 | if [ "$1" == "INCLUDE_HELPERS" ] 13 | then 14 | cp ${snippet_filename} $SNIPPET_HOME/${snippet_filename:2} 15 | echo " " ${snippet_filename:2} 16 | elif [ "${snippet_filename:2}" != "$SNIPPET_HELPER_NAME" ] 17 | then 18 | cp ${snippet_filename} $SNIPPET_HOME/${snippet_filename:2} 19 | echo " " ${snippet_filename:2} 20 | fi 21 | 22 | done 23 | echo "Copying complete." 24 | 25 | --------------------------------------------------------------------------------