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.

60 lines
1.4 KiB

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. failed_when: false
  6. tags: facts
  7. - name: Bootstrap | Run bootstrap.sh
  8. script: bootstrap.sh
  9. when: (need_bootstrap | failed)
  10. - set_fact:
  11. ansible_python_interpreter: "/opt/bin/python"
  12. tags: facts
  13. - name: Bootstrap | Check if we need to install pip
  14. shell: "{{ansible_python_interpreter}} -m pip --version"
  15. register: need_pip
  16. failed_when: false
  17. changed_when: false
  18. check_mode: no
  19. when: (need_bootstrap | failed)
  20. tags: facts
  21. - name: Bootstrap | Copy get-pip.py
  22. copy:
  23. src: get-pip.py
  24. dest: ~/get-pip.py
  25. when: (need_pip | failed)
  26. - name: Bootstrap | Install pip
  27. shell: "{{ansible_python_interpreter}} ~/get-pip.py"
  28. when: (need_pip | failed)
  29. - name: Bootstrap | Remove get-pip.py
  30. file:
  31. path: ~/get-pip.py
  32. state: absent
  33. when: (need_pip | failed)
  34. - name: Bootstrap | Install pip launcher
  35. copy:
  36. src: runner
  37. dest: /opt/bin/pip
  38. mode: 0755
  39. when: (need_pip | failed)
  40. - name: Install required python modules
  41. pip:
  42. name: "{{ item }}"
  43. with_items: "{{pip_python_modules}}"
  44. - name: Check configured hostname
  45. shell: hostname
  46. register: configured_hostname
  47. check_mode: no
  48. - name: Assign inventory name to unconfigured hostnames
  49. shell: sh -c "echo \"{{inventory_hostname}}\" > /etc/hostname; hostname \"{{inventory_hostname}}\""
  50. when: (configured_hostname.stdout == 'localhost')