Toggle navigation
FreeKB
About
Walkthroughs
Linux Commands
Sign In
FreeKB - Ansible articles
Ansible articles
Getting Started with Ansible
ansible-doc command
Getting Started with the ansible-doc command
ansible ad hoc --args command
ansible-doc become
ansible-doc connection
ansible-doc inventory
ansible-doc modules
ansible-doc shell
ansible-doc strategy
ansible-playbook command
Getting Started with the ansible-playbook command
ansible-playbook --syntax-check flag
ansible-playbook --version flag
Verbose Flags (-v -vv -vvv)
ansible command (ad-hoc task)
Getting Started with the ansible ad hoc command
ansible --version command
ansible ad hoc copy command
ansible ad hoc ping command
ansible ad hoc setup command
Ansible Galaxy
Getting Started with Ansible Galaxy
Ansible Galaxy website
ansible-galaxy info command
ansible-galaxy init command
ansible-galaxy install role (requirements)
ansible-galaxy list command
ansible-galaxy login command
ansible-galaxy remove command
ansible-galaxy search command
ansible-galaxy version command
Ansible Lint
ansible-lint
Ansible Vault
--ask-vault-pass command line option
--vault-id command line option
--vault-password-file command line option
Ansible Vault password file
ansible-vault create command
ansible-vault decrypt command
ansible-vault edit command
ansible-vault encrypt command
ansible-vault encrypt_string command
ansible-vault rekey command (change password)
ansible-vault view command
ANSIBLE_VAULT_PASSWORD_FILE environment variable
Copy an ansible vault encrypted file to managed nodes
Decrypting a vault encrypted file
vault_password_file ansible.cfg
Arrays
Getting Started with Arrays Dictionary Lists
Append values to an Array Dictionary List
Looping through an Array Dictionary List
Become
ansible_become ansible_become_user ansible_become_pass variables (sudo)
Become and --vault-password-file command line option
become command line (--become --become-user --become-method --ask-become-pass --become-flags)
become directives in ansible.cfg
become parameter (sudo)
Understanding Become Privilege Escalation
Blocks
Getting Started with the block parameter
Collections
Getting Started with Collections
Install a collection using the ansible-galaxy collection install command
Dry Run
--check (dry run) command line flag
Files
Configuration file (ansible.cfg ansible-config)
Filters
Getting Started with Filters
Capitalize first character using the capitalize filter
Collapse array to variable using the join filter
Convert an integer, boolean, or AnsibleVaultEncryptedUnicode object into a string using the string filter
Cut a string into pieces using the split filter
Cut characters from a string using index numbers
Decode a string using the b64decode filter
Define a default value using the default filter
Determine if IP address is properly formatted using the ipaddr filter
Determine the type of value stored in a variable using the type_debug filter
Encode a string using the b64encode filter
Get directory name using the dirname filter
Get file or directory name using the basename filter
Increment or Decrement an integer using the int filter
Make a date human readable using the strftime filter
regex_escape
regex_findall (grep)
regex_replace
regex_search (grep)
Remove whitespace using the trim filter
Replace data in a string or variable using the replace filter
Return an integer using the int filter
Return the first value in an array using the first filter
Return the greatest value in array using the max filter
Return the last value in an array using the last filter
Return the lowest value in array using the min filter
Return the number of items in a variable or array using the length filter
Round an integer up or down using the round filter
Sort an array using the sort filter
Update a value to lower case using the lower filter
Update a value to upper case using the upper filte
Upper case first character using the title filter
Hashes
Getting Started with Hashes (key value pairs)
Looping through an Hash
Updated hash value
Install
Install Ansible on Linux using DNF
Install Ansible on Linux using pip
Install Ansible on Linux using YUM
Install Ansible Tower on Linux
Install ansible-lint on Linux using pip
Uninstall Ansible on Linux using pip
Uninstall Ansible Tower
Inventory
--list-hosts command line option
ansible-inventory --graph command
ansible-inventory --list command
Defining your inventory
Run tasks against certain managed nodes (hosts --inventory --limit)
Run tasks on the control node
Inventory (dynamic)
Getting Started with the Dynamic Inventory
advanced_host_list dynamic inventory plugin
Cobbler dynamic inventory script
host_list dynamic inventory plugin
ini dynamic inventory plugin
nmap dynamic inventory plugin
vmware_vm_inventory dynamic inventory plugin
yaml dynamic inventory plugin
Inventory (static)
Create your own inventory file
Default hosts file
Define hostname aliases in inventory using ansible_host
Inventory file format (INI YAML)
Inventory groups (all | ungrouped | other)
Jinja2
Jinja2 templating
JSON
Getting Started parsing JSON
Loop through JSON array
Store JSON value in variable
Library
Understanding Ansible Library (modules directories)
Logs
Getting Started with Logs (log_path)
Lookup
lookup env home (users home directory)
lookup env user (whoami)
lookup file (read local file)
lookup pipe date (time)
lookup pipe hostname (control node)
lookup vars
lookup vars and nested variables
Meta
meta clear_host_errors (continue fail fatal)
Stop halt or exit a playbook using meta end_play
Modules
Getting Started with Modules
acl module (access control list getfacl setfacl)
archive module (tar zip bzip2 gzip)
assert module (ensure variable is defined)
authorized_key module
Blank out a file (command, shell)
blockinfile module (edit file)
command module (invoking a command)
copy module (copy or create file or directory)
cron module
curl module
debug module (printing output to the console)
df module (disk filesystem usage ansible_mounts)
diff module
dnf module (install update package)
docker_container module
docker_exec module
docker_image module
docker_network module
fail module
file 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 module
Get index number of an element in a list using index_of
get_url module
git module
group module (groupadd groupdel)
hostname module
include_tasks module
iptables module
iptables_state module
known_hosts module
lineinfile 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 module
mysql_db module
mysql_user module
openssh_cert module
openssh_keypair module
package module (install update a package)
parted module (create or remove partition)
pause module (sleep)
ping module
pip module
raw module (execute a command)
reboot module
rename module
replace module (edit a file)
script module (invoking a script)
seboolean module (SELinux)
selinux module
seport module (SELinux)
service module (start stop restart services chkconfig)
setup module (gather facts)
set_fact module
set_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 module
user module
user 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 Utilities
module_utils
Nested Variables
Getting Started with Nested Variables
Updating nested variables
Parameters
changed_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 parameter
ignore_errors paramater
local_action parameter
loop parameter (loop through items)
loop_control loop_var (set custom item)
mode parameter
module_defaults parameter
no_log and loop_control parameters (suppress output)
no_log parameter (mask suppress output)
owner parameter
recurse parameter
register parameter (stdout stderr rc)
remote_src parameter
retries parameter
run_once parameter
selevel parameter (SELinux)
serole parameter (SELinux)
setype parameter (SELinux)
seuser parameter (SELinux)
until parameter (while loop)
validate parameter
warnings parameter (warn: true, warn: false)
when directory is empty or not empty
when file or directory exists or does not exist
when 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 defined
when variable is empty or not empty
with_items parameter (loop through items)
with_list parameter (loop through items)
with_nested loop parameter
with_sequence parameter
playbooks
Getting Started with playbooks
Plugins
Handlers Notify Plugin
import_playbook module
Python
ansible command python version
ansible_python_interpreter fact
Retry
Retry file
Roles
Getting Started with Roles
Download role using the git clone command
Install roles from RHEL system roles (rhel-system-roles)
Invoking a role more than once using allow_duplicates
Invoking a role using the include_role module
Invoking tasks after roles using post_tasks
Invoking tasks before roles using pre_tasks
Passing variables into a Role
Role Dependencies
Role Files
Role Template Files (edit a file j2)
roles_path directory in ansible.cfg
Security
Securing passwords with Ansible
Special Variables / Connection Variables
Getting Starting with the Connection Plugin
Special Variables / Facts
Getting Started with Facts (gather_facts)
ansible_all_ipv4_addresses fact
ansible_date_time fact
ansible_default_ipv4 fact
ansible_distribution fact
ansible_distribution_major_version fact
ansible_distribution_version fact
ansible_hostname fact
ansible_lvm fact
Special Variables / Magic Variables
Getting Started with Magic Variables
ansible_limit magic variable
ansible_play_batch magic variable
ansible_play_hosts magic variable
ansible_play_hosts_all magic variable
inventory_hostname magic variable
inventory_hostname_short magic variable
playbook_dir magic variable
play_hosts magic variable
SSH
Getting 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/hosts
ansible_user ansible_ssh_pass in group_vars
remote_user parameter (SSH)
Using an encrypted password with SSH
Tags
Getting Started with Tags
Task 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)
Terminology
idempotent
Tower
Getting Started with Tower
Add managed hosts to static inventory in Tower
Create Job Schedule in Tower
Create Job Template in Tower
Create Machine Credentials in Tower
Create Project in Tower
Create static Inventory in Tower
Create Vault Credentials in Tower
Delete Job Template in Tower
Delete Project in Tower
Delete static Inventory in Tower
Extra Variables in Tower
Get latest SCM revision
Prompt for user input using Surveys in Tower
Remove managed hosts to static inventory in Tower
Start Job Template in Tower
Start Stop Restart Ansible Tower
Viewing Completed Jobs
Troubleshooting
Resolve "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 Tower
Resolve "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"
Variables
Getting Started with variables
-e --extra-vars (variables) command line option
ANSIBLE_DEBUG variable
Append value to variable
group_vars variables
include_vars
managed node variables and facts (hostvars magic variable)
nested variables
null variables
Variables in /etc/ansible/hosts or your own inventory file
vars (variables, arrays, lists)
vars_files plugin
vars_prompt
Web design by yours truely - me, myself, and I |
jeremy.canfield@freekb.net
|