Ansible

Write a playbook to deploy the file ‘/tmp/system_info’ on all hosts except for controllers group, with the following content

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

  I'm  and my operating system is

Replace and with the actual data for the specific host you are running on

The playbook to deploy the system_info file

---
- name: Deploy /tmp/system_info file
  hosts: all:!controllers
  tasks:
      - name: Deploy /tmp/system_info
        template:
            src: system_info.j2
            dest: /tmp/system_info

The content of the system_info.j2 template

# {{ ansible_managed }}
I'm {{ ansible_hostname }} and my operating system is {{ ansible_distribution }