Ansible - Sample Interview Question (Junior Level)

Considering the below playbook, which tasks will be executed first?

---
- hosts: webservers
  remote_user: root

  tasks:
  - name: ensure apache is at the latest version
    yum: name=httpd state=latest
  - name: write the apache config file
    template: src=/srv/httpd.j2 dest=/etc/httpd.conf

- hosts: databases
  remote_user: root

  tasks:
  - name: ensure postgresql is at the latest version
    yum: name=postgresql state=latest
  - name: ensure that postgresql is started
    service: name=postgresql state=started

  1. apache first and then postgresql
  2. postgresql first and then apache
  3. They will both run in parallel
  4. The order of tasks is not guaranteed
Tests in Ansible for Juniors

Test Name Difficulty Time (minutes) No. of Questions
Ansible Online Test for Juniors Ansible Junior 20 10