2015-12-30 21:15:18 +00:00
|
|
|
---
|
2016-02-19 17:48:53 +00:00
|
|
|
- name: Bootstrap | Check if bootstrap is needed
|
|
|
|
raw: stat /opt/bin/.bootstrapped
|
2015-12-30 21:15:18 +00:00
|
|
|
register: need_bootstrap
|
|
|
|
ignore_errors: True
|
2016-09-07 18:19:46 +00:00
|
|
|
|
2015-12-30 21:15:18 +00:00
|
|
|
|
2016-02-19 17:48:53 +00:00
|
|
|
- name: Bootstrap | Run bootstrap.sh
|
2015-12-30 21:15:18 +00:00
|
|
|
script: bootstrap.sh
|
2016-09-07 18:19:46 +00:00
|
|
|
when: (need_bootstrap | failed)
|
2015-12-30 21:15:18 +00:00
|
|
|
|
|
|
|
- set_fact:
|
2016-02-19 17:48:53 +00:00
|
|
|
ansible_python_interpreter: "/opt/bin/python"
|
2015-12-30 21:15:18 +00:00
|
|
|
|
2016-02-19 17:48:53 +00:00
|
|
|
- name: Bootstrap | Check if we need to install pip
|
2015-12-30 21:15:18 +00:00
|
|
|
shell: "{{ansible_python_interpreter}} -m pip --version"
|
|
|
|
register: need_pip
|
|
|
|
ignore_errors: True
|
|
|
|
changed_when: false
|
2016-09-07 18:19:46 +00:00
|
|
|
when: (need_bootstrap | failed)
|
2015-12-30 21:15:18 +00:00
|
|
|
|
2016-02-19 17:48:53 +00:00
|
|
|
- name: Bootstrap | Copy get-pip.py
|
2015-12-30 21:15:18 +00:00
|
|
|
copy: src=get-pip.py dest=~/get-pip.py
|
2016-09-07 18:19:46 +00:00
|
|
|
when: (need_pip | failed)
|
2015-12-30 21:15:18 +00:00
|
|
|
|
2016-02-19 17:48:53 +00:00
|
|
|
- name: Bootstrap | Install pip
|
2015-12-30 21:15:18 +00:00
|
|
|
shell: "{{ansible_python_interpreter}} ~/get-pip.py"
|
2016-09-07 18:19:46 +00:00
|
|
|
when: (need_pip | failed)
|
2015-12-30 21:15:18 +00:00
|
|
|
|
2016-02-19 17:48:53 +00:00
|
|
|
- name: Bootstrap | Remove get-pip.py
|
2015-12-30 21:15:18 +00:00
|
|
|
file: path=~/get-pip.py state=absent
|
2016-09-07 18:19:46 +00:00
|
|
|
when: (need_pip | failed)
|
2015-12-30 21:15:18 +00:00
|
|
|
|
2016-02-19 17:48:53 +00:00
|
|
|
- name: Bootstrap | Install pip launcher
|
|
|
|
copy: src=runner dest=/opt/bin/pip mode=0755
|
2016-09-07 18:19:46 +00:00
|
|
|
when: (need_pip | failed)
|
2015-12-30 21:15:18 +00:00
|
|
|
|
|
|
|
- name: Install required python modules
|
|
|
|
pip:
|
|
|
|
name: "{{ item }}"
|
2016-05-06 17:17:59 +00:00
|
|
|
with_items: "{{pip_python_modules}}"
|
2016-02-26 13:43:07 +00:00
|
|
|
|
|
|
|
- name: Check configured hostname
|
|
|
|
shell: hostname
|
|
|
|
register: configured_hostname
|
|
|
|
|
|
|
|
- name: Assign inventory name to unconfigured hostnames
|
|
|
|
shell: sh -c "echo \"{{inventory_hostname}}\" > /etc/hostname; hostname \"{{inventory_hostname}}\""
|
2016-09-07 18:19:46 +00:00
|
|
|
when: (configured_hostname.stdout == 'localhost')
|