Created
March 14, 2014 16:22
-
-
Save patrickheeney/9551112 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
--- | |
- name: Core | |
hosts: all | |
tasks: | |
- name: get home of current user | |
debug: msg="Value of ansible_env['HOME'] is {{ansible_env['HOME']}}" | |
- name: get value of current user | |
debug: msg="Value of ansible_env['USER'] is {{ansible_env['USER']}}" | |
- debug: var=ansible_env | |
- name: ntp | install debian ntp | |
apt: pkg={{ item }} state=latest update_cache=yes | |
with_items: | |
- ntp | |
when: ansible_os_family == 'Debian' | |
notify: ntp-restart | |
sudo: true | |
## Outputs | |
PLAY [Core] ******************************************************************* | |
GATHERING FACTS *************************************************************** | |
ok: [localhost] | |
TASK: [get home of current user] ********************************************** | |
ok: [localhost] => { | |
"msg": "Value of ansible_env['HOME'] is /home/vagrant" | |
} | |
TASK: [get value of current user] ********************************************* | |
ok: [localhost] => { | |
"msg": "Value of ansible_env['USER'] is vagrant" | |
} | |
TASK: [debug var=ansible_env] ************************************************* | |
ok: [localhost] => { | |
"ansible_env": { | |
"HOME": "/home/vagrant", | |
"LANG": "C", | |
"LC_ALL": "en_US", | |
"LOGNAME": "vagrant", | |
"MAIL": "/var/mail/vagrant", | |
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", | |
"PWD": "/home/vagrant", | |
"SHELL": "/bin/bash", | |
"SUDO_COMMAND": "/bin/sh -c echo SUDO-SUCCESS-varehwqfmpbtxgylmkxuzczrkyxpirxw; /usr/bin/python /tmp/ansible-tmp-1394814091.97-279034700901123/setup; rm -rf /tmp/ansible-tmp-1394814091.97-279034700901123/ >/dev/null 2>&1", | |
"SUDO_GID": "0", | |
"SUDO_UID": "0", | |
"SUDO_USER": "root", | |
"TERM": "vt100", | |
"USER": "vagrant", | |
"USERNAME": "vagrant" | |
} | |
} | |
TASK: [ntp | install debian ntp] ********************************************** | |
failed: [localhost] => (item=ntp) => {"failed": true, "item": "ntp"} | |
msg: Failed to lock apt for exclusive operation | |
FATAL: all hosts have already failed -- aborting | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment