2015-05-08 22:37:55 +00:00
|
|
|
- name: Hello Ansible
|
|
|
|
hosts: unglueit
|
|
|
|
vars:
|
|
|
|
user: "{{ ansible_ssh_user }}"
|
|
|
|
sudo: yes
|
|
|
|
|
2015-05-11 19:36:48 +00:00
|
|
|
pre_tasks:
|
|
|
|
- name: check apt last update
|
|
|
|
stat: path=/var/cache/apt
|
|
|
|
register: apt_cache_stat
|
|
|
|
- name: update apt if needed
|
|
|
|
apt: update_cache=yes
|
|
|
|
when: ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > 60*60*12
|
|
|
|
|
2015-05-08 22:37:55 +00:00
|
|
|
tasks:
|
|
|
|
- name: Hello server
|
|
|
|
shell: date > now.txt
|
|
|
|
|
2015-05-11 19:36:48 +00:00
|
|
|
# sudo add-apt-repository ppa:fkrull/deadsnakes-python2.7
|
|
|
|
- name: add-apt-repository ppa:fkrull/deadsnakes-python2.7
|
|
|
|
apt_repository: repo='ppa:fkrull/deadsnakes-python2.7' state=present update_cache=true
|
2015-05-08 22:37:55 +00:00
|
|
|
|
2015-05-11 19:36:48 +00:00
|
|
|
- name: do apt-get update --fix-missing
|
|
|
|
command: apt-get update --fix-missing
|
|
|
|
|
|
|
|
# sudo apt-get install python2.7
|
|
|
|
- name: installing python 2.7
|
|
|
|
apt: pkg={{ item }} update_cache=yes state=latest
|
|
|
|
with_items:
|
|
|
|
- python2.7
|
|
|
|
tags: install
|