Home
About Me
Résumé
Portfolio
DevOps
C/C++
Drupal
Java
PHP
Ruby
Symfony
WordPress
Blog
Astronomy
Fitness
Photography
RDBMS
Technology
WWF
Pictures
Instagram
Galleries
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
Contact
Search for:
Search Button
Home
About Me
Résumé
Portfolio
DevOps
C/C++
Drupal
Java
PHP
Ruby
Symfony
WordPress
Blog
Astronomy
Fitness
Photography
RDBMS
Technology
WWF
Pictures
Instagram
Galleries
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
Contact
Search for:
Search Button
Cloud Architecture
DevOps
Systems Administration
Ansible
August 31, 2022
Table of Contents
What is Ansible?
Installing on Mac
Installing on CentOS
Installing on Debian
Syncing Ansible Control Nodes
Iterating over a simple list
Iterating over a list of hashes
Using Hosts
Using Playbooks
Automation with Ansible
loop vs with_items
module: lineinfile not working as expected
Gathering OS Ansible facts
Block variables
Failed to validate GPG signature for remi-release-8.1-2.el8.remi.noarch
Hosts variables
Conditionals – Detecting Package Version
Conditionals – Detecting Package Version
Playbook stalls
missing dependency: python-apt
Unhandled error in Python interpreter discovery for host kali
WARNING: apt does not have a stable CLI interface
Docker Containers
Copying public PEM to new cloud server
Cloning Private Git Repositories
View Ansible Vault Variables
Ansible Variables
Using roles
Using var_files
Syntax Error while loading YAML
Playbook stalls (2)
Failed to connect to the host via ssh
Packages can be upgraded
ERROR! couldn’t resolve module/action ‘amazon.aws.ec2_instance’
[DEPRECATION WARNING]: amazon.aws.ec2 has been deprecated
Unable to run Ansible playbooks for AWS
Dynamic Inventories
ERROR! The ec2 dynamic inventory plugin requires boto3 and botocore
On Centos
On Debian
Viewing encrypted variablesÁ
Passing multiple variables
Templates (Jinja2)
Multiple configurations
Asking passwords
YAML Pipe vs Greater-than Symbols
group_vars and hosts_vars
MySQL
List and Dictionaries
Includes vs Imports
import, include playbook
import, include role
import, include tasks
import, include vars
Testing bmo-deploy.yml
Prerequisite
Uploading artifacts
Executing playbook
Verifying files
ERROR! couldn’t resolve module/action cummunity.general.mail
ERROR! The role ‘olbb-restart’ was not found
ERROR! couldn’t resolve module/action syslogger
changed_when vs failed_when
changed_when
failed_when
Variable precedence
Test 1 – Who will win?
Test 2 – Who will win?
Test 3 – Who will win?
Why do I get these consistent results?
Test 4 – Who will win?
Test 5 – Who will win?
Combining Variables
Declaring Variables
Ad-hoc commands – Sorting hosts
Tags – Targeting roles and tasks
MySQL – The error was: ‘dict object’ has no attribute ‘root’
User Management
Lessons Learned
MySQL – unable to install pip pymysql
Vault – Encrypting variables
Vault – Encrypting files
Creating encrypted files
Encrypting existing files
Viewing encrypted files
Editing encrypted files
Changing the password and/or vault ID on encrypted files
Decrypting encrypted files
Escaping double quotes
Roles
The connection plugin ‘docker’ was not found
An unhandled exception occurred while running the lookup plugin ‘template’
Output formatting
Timing Playbooks
–ask-pass (-k) & –ask-become-pass (-K) & –ask-vault-pass
Missing sudo password
Problem
Solution for MacOS
Solution for BMO (Not yet found)
Dictionary extra variable
ansible_date_time timezone
Breakpoints
ERROR! couldn’t resolve module/action ‘ansible.posix.authorized_key’
Working with a List of Dictionaries – selectattr() and map()
Failed to import the required Python library (botocore and boto3)
Attempt 1 – failed but progressing…
Attempt 2 – failed but progressing…
Attempt 3 – failed but progressing…
Attempt 4 – failed but progressing…
Attempt 5 – failed
Attempt 6 – failed
Attempt 7 – failed
Attempt 8 – failed
Attempt 9 – failed
Attempt 10 – Succeeded
Preserving Tabs with Debug Module
[WARNING]: Unable to parse {{ INVENTORY }} as an inventory source
{{ VARIABLE_NAME }} is undefined
Ad-hoc commands
Ad-hoc commands – Sorting hosts
Ad-hoc commands with –extra-vars in JSON/YAML file
An unhandled exception occurred while running the lookup plugin ‘template’
Ansible API
Ansible playbook debugging
Ansible Tower migration to Ansible Automation Platform (AAP)
Ansible Tower/AAP: Auto-deploy script to launch Job Templates does not clear Job Tags an/or skip Tag Fields
Ansible Tower/AAP: Boolean variables not treated as such
Ansible Tower/AAP: Connection failure: The read operation timed out
Ansible Tower/AAP: Creating Projects and Templates
Ansible Tower/AAP: Job failed and has no output
Can’t use own inventory
Can’t use sudo
Can’t use tags
Certificate Management
Conditionals – Detecting Package Version
Conflicting characters
Error creating {{ DIRECTORY }}
ERROR! Attempting to decrypt but no vault secrets found
ERROR! couldn’t resolve module/action ‘amazon.aws.ec2_instance’
ERROR! couldn’t resolve module/action ‘ansible.posix.authorized_key’
ERROR! couldn’t resolve module/action ‘community.general.mail’
ERROR! couldn’t resolve module/action ‘cummunity.general.mail’
ERROR! couldn’t resolve module/action ‘sefcontext’
ERROR! couldn’t resolve module/action ‘syslogger’
ERROR! Decryption failed
ERROR! the role ‘{{ ROLE_NAME }}’ was not found
Escaping special characters
Execute playbook as another user
Failed to change ownership of the temporary files Ansible needs to create despite connecting as a priviledge user. Unprivileged become user would be unable to read the file.
HTTP Error 401: Unauthorized
HTTP Error 403: Forbidden
Linting
Lists and Dictionaries
Loops – loop vs with_items
Maximum recursion depth exceeded
Missing variable(s)
Multiple configurations for multiple organizations
No space left on device
Object of type ‘int’ has no len() VS ‘>’ not supported between instances of ‘str’ and ‘int’
Patch Management
Precondition failed
role: include_vault fails
SCM Update
Special variables
sudo: /etc/sudo.conf is owned by uid *
Tags
Tags: include/exclude roles
Tags: include/exclude tasks
Jinja Templates
The connection plugin ‘docker’ was not found
Timeout (12s) waiting for priviledge escalation prompt
Unreachable hosts
Using a SSH password instead of a key is not possible because host key checking is enabled and sshpass does not support this.
Vault
Vault: Encrypting files
Vault: Encrypting variables
Working with a List of Dictionaries – selectattr() and map()
ansible
,
cloud-architecture
,
devops
,
systems-administration
Written By victord On August 31, 2022