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 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 EscalationBlocksGetting Started with the block parameterCollectionsGetting Started with CollectionsInstall a collection using the ansible-galaxy collection install commandDry Run--check (dry run) command line flagFilesConfiguration file (ansible.cfg ansible-config)FiltersGetting Started with FiltersCapitalize first character using the capitalize filterCollapse array to variable using the join filterConvert an integer, boolean, or AnsibleVaultEncryptedUnicode object into a string using the string filterCut a string into pieces using the split filterCut characters from a string using index numbersDecode a string using the b64decode filterDefine a default value using the default filterDetermine if IP address is properly formatted using the ipaddr filterDetermine the type of value stored in a variable using the type_debug filterEncode a string using the b64encode filterGet directory name using the dirname filterGet file or directory name using the basename filterIncrement or Decrement an integer using the int filterMake a date human readable using the strftime filterregex_escaperegex_findall (grep)regex_replaceregex_search (grep)Remove whitespace using the trim filterReplace data in a string or variable using the replace filterReturn an integer using the int filterReturn the first value in an array using the first filterReturn the greatest value in array using the max filterReturn the last value in an array using the last filterReturn the lowest value in array using the min filterReturn the number of items in a variable or array using the length filterRound an integer up or down using the round filterSort an array using the sort filterUpdate a value to lower case using the lower filterUpdate a value to upper case using the upper filteUpper case first character using the title 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 fileDefine hostname aliases in inventory using ansible_hostInventory 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 variablesMetameta clear_host_errors (continue fail fatal)Stop halt or exit a playbook using meta end_playModulesGetting 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 index number of an element in a list using index_ofget_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 (while 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 playbooksPluginsHandlers Notify Pluginimport_playbook modulePythonansible command python versionansible_python_interpreter factRetryRetry fileRolesGetting Started with RolesDownload role using the git clone commandInstall roles from RHEL system roles (rhel-system-roles)Invoking a role more than once using allow_duplicatesInvoking a role using the include_role moduleInvoking tasks after roles using post_tasksInvoking tasks before roles using pre_tasksPassing variables into a RoleRole DependenciesRole FilesRole Template Files (edit a file j2)roles_path directory in ansible.cfgSecuritySecuring passwords with AnsibleSpecial Variables / Connection VariablesGetting Starting with the Connection PluginSpecial Variables / FactsGetting Started with Facts (gather_facts)ansible_all_ipv4_addresses factansible_date_time factansible_default_ipv4 factansible_distribution factansible_distribution_major_version factansible_distribution_version factansible_hostname factansible_lvm factSpecial Variables / Magic VariablesGetting Started with Magic Variablesansible_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 variableSSHGetting 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 "AnsibleVaultEncryptedUnicode object has no attribute split"Resolve "Attempting to decrypt but no vault secrets found"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 "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 optionANSIBLE_DEBUG variableAppend value to variablegroup_vars variablesinclude_varsmanaged node variables and facts (hostvars magic variable)nested variablesnull variablesVariables in /etc/ansible/hosts or your own inventory filevars (variables, arrays, lists)vars_files pluginvars_prompt

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |