Last active
October 9, 2017 22:22
-
-
Save paulopatto/d70c89a4741b26422b78693ed54bbf80 to your computer and use it in GitHub Desktop.
Exemplos de tarefas com Ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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