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.

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