FreeKB - Ansible articles
Ansible articles

Getting Started with Ansibleansible-doc commandGetting Started with the ansible-doc commandansible ad hoc --args commandansible-doc becomeansible-doc connectionansible-doc inventoryansible-doc modulesansible-doc shellansible-doc strategyansible-playbook commandGetting Started with the ansible-playbook commandansible-playbook --syntax-check flagansible-playbook --version flagVerbose Flags (-v -vv -vvv)ansible command (ad-hoc task)Getting Started with the ansible ad hoc commandansible --version commandansible ad hoc copy commandansible ad hoc ping commandansible ad hoc setup commandAnsible GalaxyGetting Started with Ansible GalaxyAnsible Galaxy websiteansible-galaxy info commandansible-galaxy init commandansible-galaxy install collectionansible-galaxy install role (requirements)ansible-galaxy list commandansible-galaxy login commandansible-galaxy remove commandansible-galaxy search commandansible-galaxy version commandAnsible Lintansible-lintAnsible Vault--ask-vault-pass command line option--vault-id command line option--vault-password-file command line optionAnsible Vault password fileansible-vault create commandansible-vault decrypt commandansible-vault edit commandansible-vault encrypt command ansible-vault encrypt_string commandansible-vault rekey command (change password)ansible-vault view commandANSIBLE_VAULT_PASSWORD_FILE environment variableCopy an ansible vault encrypted file to managed nodesDecrypting a vault encrypted filevault_password_file ansible.cfgArraysGetting Started with Arrays Dictionary ListsAppend values to an Array Dictionary ListLooping through an Array Dictionary ListBecomeansible_become ansible_become_user ansible_become_pass variables (sudo)Become and --vault-password-file command line optionbecome command line (--become --become-user --become-method --ask-become-pass --become-flags)become directives in ansible.cfgbecome parameter (sudo)Understanding Become Privilege EscalationDry Run--check (dry run) command line flagFactsGetting Started with Facts (gather_facts)ansible_all_ipv4_addressesansible_default_ipv4ansible_lvm factFilesConfiguration file (ansible.cfg ansible-config)FiltersGetting Started with Filtersb64decode filterb64encode filterbasename filtercapitalize first charactercut characters from a string (index)dirname filterfirst filter (first value in an array list)int filter (integers math)ipaddr filter (IP address)join filter (collapse array to variable)last filter (last value in an array list)length filterlower filtermax filter (greatest value in array)min filter (lowest value in array)regex_escaperegex_findall (grep)regex_replaceregex_search (grep)replace filterround filtersort filtersplit (cut a string into pieces)strftime filterstring filter (unicode)title upper case first charactertrim whitespacetype_debug filter (integer, boolean, string, AnsibleUnicode, AnsibleUnsafeText, AnsibleVaultEncryptedUnicode)upper filterHashesGetting Started with Hashes (key value pairs)Looping through an HashUpdated hash valueInstallInstall Ansible on Linux using DNFInstall Ansible on Linux using pipInstall Ansible on Linux using YUMInstall Ansible Tower on LinuxInstall ansible-lint on Linux using pipUninstall Ansible on Linux using pipUninstall Ansible TowerInventory--list-hosts command line optionansible-inventory --graph commandansible-inventory --list commandDefining your inventoryRun tasks against certain managed nodes (hosts --inventory --limit)Run tasks on the control nodeInventory (dynamic)Getting Started with the Dynamic Inventoryadvanced_host_list dynamic inventory pluginCobbler dynamic inventory scripthost_list dynamic inventory pluginini dynamic inventory pluginnmap dynamic inventory pluginvmware_vm_inventory dynamic inventory pluginyaml dynamic inventory pluginInventory (static)Create your own inventory fileDefault hosts fileInventory aliases (ansible_host)Inventory file format (INI YAML)Inventory groups (all | ungrouped | other)Jinja2Jinja2 templatingJSONGetting Started parsing JSONLoop through JSON arrayStore JSON value in variableLibraryUnderstanding Ansible Library (modules directories)LogsGetting Started with Logs (log_path)Lookuplookup env home (users home directory)lookup env user (whoami)lookup file (read local file)lookup pipe date (time)lookup pipe hostname (control node)lookup varslookup vars and nested variablesMagic VariablesGetting Started with Magic Variablesansible_date_time magic variableANSIBLE_DEBUG variableansible_distribution magic variableansible_distribution_major_version magic variableansible_distribution_version magic variableansible_hostname magic variableansible_limit magic variableansible_play_batch magic variableansible_play_hosts magic variableansible_play_hosts_all magic variableinventory_hostname magic variableinventory_hostname_short magic variableplaybook_dir magic variableplay_hosts magic variableMetameta clear_host_errors (continue fail fatal)meta end_play (stop halt exit playbook)ModulesGetting Started with Modulesacl module (access control list getfacl setfacl)archive module (tar zip bzip2 gzip)assert module (ensure variable is defined)authorized_key moduleBlank out a file (command, shell)blockinfile module (edit file)command module (invoking a command)copy module (copy or create file or directory)cron modulecurl moduledebug module (printing output to the console)df module (disk filesystem usage ansible_mounts)diff modulednf module (install update package)docker_container moduledocker_exec moduledocker_image moduledocker_network modulefail modulefile module (change owner group mode permissions chown chgrp chmod)file module (create a symbolic link symlink soft link)file module (create directory mkdir)file module (create file touch)file module (delete remove files directories rmdir)filesystem module (partition file system)find module (list files and directories)firewalld moduleget_url modulegit modulegroup module (groupadd groupdel)hostname moduleinclude_tasks moduleiptables moduleiptables_state moduleknown_hosts modulelineinfile module (edit file)lvg module (LVM volume groups)lvol module (LVM logical volumes)mail module (send email)mount module (mount and unmount partition /etc/fstab)move modulemysql_db modulemysql_user moduleopenssh_cert moduleopenssh_keypair modulepackage module (install update a package)parted module (create or remove partition)pause module (sleep)ping modulepip moduleraw module (execute a command)reboot modulerename modulereplace module (edit a file)script module (invoking a script)seboolean module (SELinux)selinux moduleseport module (SELinux)service module (start stop restart services chkconfig)setup module (gather facts)set_fact moduleset_fact module (array of values)shell module (invoking a shell command)shell module (write local file)slurp module (read file)stat module (file statistics)synchronize module (copy files directories)systemd module (start stop restart services)unarchive module (tar zip bzip2 gzip)uri moduleuser moduleuser module (create keypair)user module (groups)yum module (install update package)yum module (list available installed packages)yum module (uninstall delete remove package)yum_repository module (add repo)Module Utilitiesmodule_utilsNested VariablesGetting Started with Nested VariablesUpdating nested variablesParameterschanged_when parameter check_mode parameter (dry run)delay parameter delegate_to parameter (run task on specific server)failed_when parameter (skip tasks)group parameter hosts parameterignore_errors paramaterlocal_action parameterloop parameter (loop through items)loop_control loop_var (set custom item)mode parameter module_defaults parameterno_log and loop_control parameters (suppress output)no_log parameter (mask suppress output)owner parameter recurse parameterregister parameter (stdout stderr rc)remote_src parameterretries parameter run_once parameterselevel parameter (SELinux)serole parameter (SELinux)setype parameter (SELinux)seuser parameter (SELinux)until parameter (loop)validate parameterwarnings parameter (warn: true, warn: false)when directory is empty or not emptywhen file or directory exists or does not existwhen file or directory is writeable (out.stat.writeable)when object is or is not a directory (out.stat.isdir)when parameter (if else statement)when variable is defined or not definedwhen variable is empty or not emptywith_items parameter (loop through items)with_list parameter (loop through items)with_nested loop parameterwith_sequence parameterplaybooksGetting Started with playbooksPluginsconnection pluginHandlers Notify Pluginimport_playbook modulePythonansible command python versionansible_python_interpreter factRetryRetry fileRolesGetting Started with RolesDownload role using the git clone commandinclude_roleInstall roles from RHEL system roles (rhel-system-roles)post_taskspre_tasksRole DependenciesRole Duplication (allow_duplicates)Role FilesRole Template Files (edit a file j2)Role Variablesroles_path directory in ansible.cfgSecuritySecuring passwords with AnsibleSSHGetting Started with SSH--ask-pass (SSH) command line flag--connection command line flag--user command line option (SSH)ansible_user ansible_ssh_pass in /etc/ansible/hostsansible_user ansible_ssh_pass in group_varsremote_user parameter (SSH)Using an encrypted password with SSHTagsGetting Started with TagsTask Execution (Parallelism)Getting Started with Task Execution (Parallelism)--forks command line option (Parallelism)--list-tasks command line option (Parallelism)Debug Strategy (Parallelism)forks in ansible.cfg (Parallelism)Free Strategy (Parallelism)Host Pinned Strategy (Parallelism)Linear Strategy (Parallelism)Understanding Forks (Parallelism)Understanding Serial (Parallelism)Understanding Throttle (Parallelism)TerminologyidempotentTowerGetting Started with TowerAdd managed hosts to static inventory in TowerCreate Job Schedule in TowerCreate Job Template in TowerCreate Machine Credentials in TowerCreate Project in TowerCreate static Inventory in TowerCreate Vault Credentials in TowerDelete Job Template in TowerDelete Project in TowerDelete static Inventory in TowerExtra Variables in TowerGet latest SCM revisionPrompt for user input using Surveys in TowerRemove managed hosts to static inventory in TowerStart Job Template in TowerStart Stop Restart Ansible TowerViewing Completed JobsTroubleshootingResolve "ansible.parsing.yaml.objects.AnsibleVaultEncryptedUnicode object has no attribute split"Resolve "couldn't resolve module"Resolve "Destination not writable"Resolve "Distribution should use /usr/bin/python3, but is using /usr/bin/python"Resolve "Encountered unknown tag"Resolve "Error reading config file (ansible.cfg): File contains no section headers"Resolve "ERROR! Attempting to decrypt but no vault secrets found"Resolve "Failed to connect to the host via ssh Permission denied"Resolve "Failed to parse foo.yml with foo plugin"Resolve "Job terminated due to timeout" in Ansible TowerResolve "module not found"Resolve "non-zero return code"Resolve "The loop variable 'item' is already in use"Resolve "There was an issue creating as requested: [Erroro 13] Permission denied"Resolve "unable to connect to database, check login_user and login_password are correct or /root/.my.cnf has the credentials"Resolve "unreachable could not resolve hostname name or service not known"Resolve "urlopen error timed out"VariablesGetting Started with variables-e --extra-vars (variables) command line optionAppend value to variablegroup_vars variablesinclude_varsmanaged node variables and facts (hostvars)null variablesVariables in /etc/ansible/hosts or your own inventory filevars plugin (variables, arrays, lists)vars_files pluginvars_prompt