- name: Installs Apache and starts the service
hosts: webserver
vars:
base_path: /srv/users/host1/mgmt/sys/users
users:
joe:
name: Joe Foo
home: "{{ base_path }}/joe"
bob:
name: Bob Bar
home: "{{ base_path }}/bob"
tasks:
- name: Print user details records
debug: msg="User {{ item.key }} full name is {{ item.value.name }}. Home is {{ item.value.home }}"
with_dict: "{{users}}"
Variables defined in the playbook
- hosts: webservers
vars:
http_port: 80
Register the output to a variable via register keyword
---
- hosts: all
tasks:
- name: Checking if Sources are Available
shell: echo "This is a test"
register: results