Ansible PRO TIP:
Use the community.general.yaml callback plugin to beautify your Ansible playbook output.
Makes debugging SO much easier.
Just place this in your ansible.cfg.
Ansible PRO TIP:
Speed up your playbook's completion time with async & poll actions.
- Skip the wait for lenghty tasks
- Execute add'l tasks concurrently
- Circle back to assess results when rdy
Ansible PRO TIP:
If youโre running an Ansible playbook over and overโฆ
Boost your playbook speed with fact caching.
Itโs going to speed up all your re-runs and you donโt need to waste time regathering facts especially when they donโt change much.
Add in ansible.cfg
Ansible PRO TIP:
Use Blocks to group tasks and apply shared properties like become.
Especially helpful when say you have a set of tasks that you want to logically group for a particular OS family.
Example
๐๐๐๐๐๐
Ansible PRO TIP:
Enhance your playbooks' reliability with block, rescue, and always.
- Group tasks under block
- Manage errors with rescue
- Guarantee tasks execute with always
Ansible PRO TIP:
Sometimes the playbook execution breaks.
Take advantage of these Ansible options when running your playbooks.
-vvv
--step
--check
--diff
--start-at-task
Ansible PRO TIP:
Simplify your loop outputs.
When looping over complex data structures donโt drown in excess data.
Use loop_control to cherry-pick exactly what you want to see.
Not only will it make reading your output MUCH easier, itโll speed up playbook performance!
Ansible PRO TIP:
Use the community.general.yaml callback plugin to beautify your Ansible playbook output.
Makes debugging SO much easier.
Just place this in your ansible.cfg.
Ansible PRO TIP:
Assert Your Assumptions!
Before deploying changes, use ansible.builtin.assert to verify that your environment meets your prerequisites.
Here Iโm using the assert module to ensure that my hosts are part of the RH family before I continue.
Ansible PRO TIP:
Embrace Roles
Break down your playbook tasks into roles.
Roles enable you to easily reuse code and manage dependencies across your playbooks, making them more maintainable.
This blog on Terraform + Ansible is ๐ฅ
Take Terraform and combine it with the power of
@ansible
, you get a truly efficient workflow.
That demo at the bottom
@NunoMart11
is ๐คฉ
Ansible PRO TIP:
Use โno_log: trueโ to shield sensitive details.
Allows you to:
- Share playbook output w/o revealing secrets
- Keep centralized logs clean of sensitive details
Ansible PRO TIP:
Ensure dependencies are ready with 'wait_for'
- Wait for specific conditions, e.g. like ports open
- Avoid blind sleeps
- Great for orchestrating multi-step deployments/installs
Ansible PRO TIP:
Leverage dynamic variables to create flexible configurations.
Example of turning a feature on or off based on if itโs in prod or dev.
Ansible PRO TIP:
Use 'gather_facts: no' when system facts arenโt needed.
โ Saves time by skipping unnecessary data collection.
โ Ideal for tasks where host-specific facts arenโt essential.
Ansible just got smarter with event-driven automation.
Here are FIVE different ways to make your IT work:
* faster
* simpler
* more effective
๐งตA thread
Ansible PRO TIP:
Use 'delegate_to' to control where a task runs.
Perfect way to execute a task on a different host than the current one in play.
Ex: checking connectivity of a URL from the localhost's perspective
Ansible PRO TIP:
Boost your playbook's performance by managing the number of forks.
Adjust the forks value in your ansible.cfg
- More forks allows you to execute more tasks on multiple hosts in parallel
- Tune carefully considering the resources on your control node
Ansible PRO TIP:
Leverage 'any_errors_fatal: true' for mission critical scenarios.
-Ideal when tasks have strict dependencies
-Ideal when a task MUST succeed before continuing
-Stops executing play on all hosts upon failure
Ex: Upgrade kicks off ONLY if all LBs are disabled.
Ansible Automation Platformโฆ.
Youโre using it wrong. ๐ซ
4 hidden gems ๐ you never knew your Ansible Automation Platform could do:
๐งต//THREAD// ๐งต
๐๐๐
I spent over ๐ฏ hours learning to optimize
@ansible
Automation Platform on Red Hat
@openshift
so you donโt have to.
5 things every solutions architect should know: ๐งต
Ansible PRO TIP:
Prevent changes from hitting all hosts at once using โserialโ.
โ Essential for restarts/updates that canโt happen at once
โ Reduces risk of service outages
โ Allows changes in controlled batches
Example of running commands in batches of 3.
Ansible PRO TIP:
When you work with REST APIs use the โregisterโ keyword to store API response data.
This allows you to:
* Adapt automation based on responses
* Pass data between API calls
* Manage errors and customize alerts
Ansible PRO TIP:
Use filters for advanced data handling in your tasks.
โ json_query - Ideal for sifting through complex JSON data.
โ regex_replace - Transform string formats effortlessly.
โ map - Transform lists of data efficiently.
Love the use of
@Ansible
& ChatGPT in this scenario
1. Windows event fires
2. EDA captures it
3. Ansible job queries ChatGPT w/ event details
4. ChatGPT deciphers & suggests fixes
5. Ansible creates a ServiceNow ticket w/ the issue & suggested solutions
BREAKING: IBM introduces watsonx!
What is watsonx?
IBMโs next gen AI and data platform.
Hereโs what it means for Ansible developers like you: ๐งต
#Think2023
Ansible PRO TIP:
Don't limit yourself to a static inventory.
Ansible can pull in dynamic inventories from your cloud providers.
Giving you the ability to easily automate your cloud environments.
Ansible PRO TIP:
Use the assert module to make certain prerequisite conditions are met.
This helps you:
- prevent unexpected errors๐ซ
- boost reliability ๐ผ
Plus, early playbook failures makes for easier debugging.
Sometimes the playbook execution breaks.
Take advantage of these Ansible options when running your playbooks.
-vvvv
-- step
-- check
-- diff
-- start-at-task
Ansible PRO TIP:
Make your Ansible playbooks modular and reusable by using roles.
Itโs going to make your playbooks:
- easier to read
- easier to share
- easier to maintain
Ansible Collections are a must if you:
-value reusability
- value code organization
- value collaborating with teams
Here's super simple guide to using them.
Last week at Red Hat Summit, Ansible Lightspeed was announced -- an AI built for IT automation
Here's a breakdown of:
- What it is
- What it isn't
- How you should use it
- How to get started with it
//THREAD ๐งต//
#RHSummit
๐ฅ Created a 2 min step-by-step video on how to deploy
@Ansible
Automation Platform on
@openshift
๐ Takeaways:
- Operators make the install a breeze
- Access to all AAP components (controller, automation hub, Event Driven Ansible)
- Up in minutes not hours
I love this video that
@keithtenzer
put together around
@Ansible
Automation Platform
You may:
-Know what Ansible is
-Know how to use Ansible
-Know about automation controller
But do you know what a platform is around Ansible?
A must watch!
๐๐๐
Built a demo that moves an application between
@openshift
clusters using ACM and
@Ansible
โ automatically.
- Triggered by a Prometheus alert
- Directed by an EDA rulebook
- Assisted by ACM Submariner & AAP automation controller
Check it out!!
If you understand these components of a Disaster Recovery (DR) plan with Ansible, youโre ahead of 99% of people:
- Disaster Event Detection
- Primary Site Shutdown
- Failover Procedure
- Return to Normal Operations
Read on for how Ansible can help:
๐งต ๐
#AnsibleFest
may be over but the fun donโt stop here!
Want to learn the basics of Event-Driven Ansible?
Maybe how to scale with automation mesh?
Or you just want to run your first Ansible playbook.
Thereโs an ON DEMAND FREE lab waiting for you @
Ansible PRO TIP:
Apply tags to tasks within your playbook.
This allows you to execute only a subset of tasks when running a playbook.
Especially great when youโre debugging.
Ansible PRO TIP:
Make handling complicated objects easier with the ansible.utils collection.
Use the lookup plugin to:
- Change an object into a simple list of paths & values
- Paths are dot delimited (making them easier to read & use)
Ansible PRO TIP:
Beyond the basic Jinja2 templating, use filters to transform data inside a template expression.
Ex:
{{ a_var | default('default_value') }}
Give a default value or even use โomitโ as your value to make a var optional.
More filters
๐
Last week there was an Ansible Community Meetup - Better Together: Exploring Ansible & Terraform
And at the roughly 33 min mark thereโs a sweet demo thanks to
@IPvSean
๐๐๐๐๐
Asynchronous Actions & Polling:
Use the async and poll parameters to run tasks asynchronously.
This starts the sleep 30 cmd, then continues with the next task, then checks back every 10 secs to see if the cmd is done.
If not done after 40 secs, Ansible fails the task.
๐จIf business continuity matters to you, this oneโs for you. ๐
Spent last week diving into Event Driven
@Ansible
, ACM & AAP. ๐
Built a demo that moves an application between
@openshift
clustersโ automatically.
- Triggered by a Prometheus alert
- Directed by an EDA
Imagine rapid Linux upgrades for remote edge devices ๐, no IT staff needed!
Now envision:
- Upgrading at scaleโจ
- Faster vulnerability patching๐
๐ฅ Meet Ansible validated content's infra.osbuild Collection for Edge deployments!
Letโs take a closer look. ๐งต
๐๐๐๐