You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.3 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. ---
  2. - name: Bootstrap | Check if bootstrap is needed
  3. raw: stat /opt/bin/.bootstrapped
  4. register: need_bootstrap
  5. ignore_errors: True
  6. - name: Bootstrap | Run bootstrap.sh
  7. script: bootstrap.sh
  8. when: (need_bootstrap | failed)
  9. - set_fact:
  10. ansible_python_interpreter: "/opt/bin/python"
  11. - name: Bootstrap | Check if we need to install pip
  12. shell: "{{ansible_python_interpreter}} -m pip --version"
  13. register: need_pip
  14. ignore_errors: True
  15. changed_when: false
  16. when: (need_bootstrap | failed)
  17. - name: Bootstrap | Copy get-pip.py
  18. copy: src=get-pip.py dest=~/get-pip.py
  19. when: (need_pip | failed)
  20. - name: Bootstrap | Install pip
  21. shell: "{{ansible_python_interpreter}} ~/get-pip.py"
  22. when: (need_pip | failed)
  23. - name: Bootstrap | Remove get-pip.py
  24. file: path=~/get-pip.py state=absent
  25. when: (need_pip | failed)
  26. - name: Bootstrap | Install pip launcher
  27. copy: src=runner dest=/opt/bin/pip mode=0755
  28. when: (need_pip | failed)
  29. - name: Install required python modules
  30. pip:
  31. name: "{{ item }}"
  32. with_items: "{{pip_python_modules}}"
  33. - name: Check configured hostname
  34. shell: hostname
  35. register: configured_hostname
  36. - name: Assign inventory name to unconfigured hostnames
  37. shell: sh -c "echo \"{{inventory_hostname}}\" > /etc/hostname; hostname \"{{inventory_hostname}}\""
  38. when: (configured_hostname.stdout == 'localhost')