Skip to content

Instantly share code, notes, and snippets.

@paulopatto
Last active October 9, 2017 22:22
Show Gist options
  • Save paulopatto/d70c89a4741b26422b78693ed54bbf80 to your computer and use it in GitHub Desktop.
Save paulopatto/d70c89a4741b26422b78693ed54bbf80 to your computer and use it in GitHub Desktop.
Exemplos de tarefas com Ansible
# ansible-playbook -i 'localhost,' --connection=local -K ./whoami.yml
- name: Show return value of command
hosts: all
gather_facts: true
become: false
tasks:
- name: "capture output of id command"
command: id -un
register: login
- debug: msg= "Logged in as user {{ login.stdout }}"
- name: "capture output of whoami command"
command: whoami
register: who
- debug: var=who
# Examploe of facts: https://github.com/lorin/ansible-quickref/blob/master/facts.rst
# - name: "Print out Operating System"
- debug: var=ansible_distribution
- debug: var=ansible_system
- debug: var=ansible_distribution_release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment