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.

53 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: src=get-pip.py dest=~/get-pip.py
  23. when: (need_pip | failed)
  24. - name: Bootstrap | Install pip
  25. shell: "{{ansible_python_interpreter}} ~/get-pip.py"
  26. when: (need_pip | failed)
  27. - name: Bootstrap | Remove get-pip.py
  28. file: path=~/get-pip.py state=absent
  29. when: (need_pip | failed)
  30. - name: Bootstrap | Install pip launcher
  31. copy: src=runner dest=/opt/bin/pip mode=0755
  32. when: (need_pip | failed)
  33. - name: Install required python modules
  34. pip:
  35. name: "{{ item }}"
  36. with_items: "{{pip_python_modules}}"
  37. - name: Check configured hostname
  38. shell: hostname
  39. register: configured_hostname
  40. check_mode: no
  41. - name: Assign inventory name to unconfigured hostnames
  42. shell: sh -c "echo \"{{inventory_hostname}}\" > /etc/hostname; hostname \"{{inventory_hostname}}\""
  43. when: (configured_hostname.stdout == 'localhost')