54 lines
1.3 KiB
YAML
54 lines
1.3 KiB
YAML
##
|
|
## Lets prep
|
|
##
|
|
|
|
- name: Preparation
|
|
hosts: all
|
|
gather_facts: False
|
|
pre_tasks:
|
|
- name: install ansible dependencies (python)
|
|
raw: test -e /usr/bin/python || (apt-get -y update && apt-get install -y python-minimal python-pkg-resources) # install pkg-resources to avoid needlesly triggering the next test
|
|
changed_when: False
|
|
|
|
- name: install ansible dependencies (python-pkg-resources)
|
|
raw: test -e /usr/lib/python2.7/dist-packages/pkg_resources.py || (apt-get -y update && apt-get install -y python-pkg-resources)
|
|
changed_when: false # raw has no change handler
|
|
|
|
##
|
|
## Ansible stuff
|
|
##
|
|
|
|
- name: Install ansible
|
|
hosts: ansible-controller
|
|
gather_facts: True
|
|
tasks:
|
|
- name: Add Ansible gpg key
|
|
apt_key:
|
|
keyserver: keyserver.ubuntu.com
|
|
id: "93C4A3FD7BB9C367"
|
|
register: ansible_gpg_key_result
|
|
|
|
- name: Add Ansible ppa
|
|
apt_repository:
|
|
repo: "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main"
|
|
register: ansible_ppa_result
|
|
|
|
- name: Update apt cache if repo or key added.
|
|
apt:
|
|
update_cache: yes
|
|
when: ansible_ppa_result.changed or ansible_gpg_key_result.changed
|
|
|
|
- name: Install ansible
|
|
apt:
|
|
name: ansible
|
|
|
|
##
|
|
## roles roles roles
|
|
##
|
|
|
|
- name: common roles
|
|
hosts: all
|
|
tags:
|
|
- common
|
|
roles:
|
|
- common |