DevOps / Ansible Interview questions
Explain the execution flow of a rolling update using serial?
serial splits a play's target hosts into smaller batches and runs the entire play (all its tasks and handlers) to completion for one batch before starting the next, instead of running each task against every host at once.
- hosts: webservers serial: 2 max_fail_percentage: 20 tasks: - name: Deploy new app version ansible.builtin.command: /opt/deploy.sh - name: Health check ansible.builtin.uri: url: "http://{{ inventory_hostname }}/health" register: health until: health.status == 200 retries: 5
With serial: 2, only 2 hosts are taken through the whole play at a time - deploy, health check, and any handlers - before the next 2 hosts start, keeping the majority of the fleet serving traffic throughout the rollout. max_fail_percentage adds a safety valve: if failures across completed batches exceed that threshold, Ansible stops starting new batches rather than continuing to roll a broken change out to the entire fleet. serial can also take a list (e.g. [1, 5, "100%"]) to start with a small canary batch and progressively widen, which is a common pattern for cautious production rollouts.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
