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.

76 lines
2.1 KiB

8 years ago
  1. ---
  2. - name: Fetch /etc/os-release
  3. raw: cat /etc/os-release
  4. register: os_release
  5. changed_when: false
  6. environment: {}
  7. - name: Set bootstrap_os
  8. set_fact:
  9. os_family: >-
  10. {%- if 'Ubuntu' in os_release.stdout -%}
  11. ubuntu
  12. {%- elif 'Debian' in os_release.stdout -%}
  13. debian
  14. {%- elif 'CoreOS' in os_release.stdout -%}
  15. coreos
  16. {%- elif 'Fedora' in os_release.stdout -%}
  17. fedora
  18. {%- elif 'CentOS' in os_release.stdout -%}
  19. centos
  20. {%- elif 'OpenSUSE' in os_release.stdout -%}
  21. opensuse
  22. {%- endif -%}
  23. - include_tasks: bootstrap-ubuntu.yml
  24. when: os_family == "ubuntu"
  25. - include_tasks: bootstrap-debian.yml
  26. when: os_family == "debian"
  27. - include_tasks: bootstrap-coreos.yml
  28. when: os_family == "coreos"
  29. - include_tasks: bootstrap-fedora.yml
  30. when: os_family == "fedora"
  31. - include_tasks: bootstrap-centos.yml
  32. when: os_family == "centos"
  33. - include_tasks: bootstrap-opensuse.yml
  34. when: os_family == "opensuse"
  35. - import_tasks: setup-pipelining.yml
  36. - name: Create remote_tmp for it is used by another module
  37. file:
  38. path: "{{ lookup('config', 'DEFAULT_REMOTE_TMP', on_missing='skip', wantlist=True) | first | default('~/.ansible/tmp') }}"
  39. state: directory
  40. mode: 0700
  41. - name: Gather nodes hostnames
  42. setup:
  43. gather_subset: '!all'
  44. filter: ansible_*
  45. - name: Assign inventory name to unconfigured hostnames (non-CoreOS and Tumbleweed)
  46. hostname:
  47. name: "{{inventory_hostname}}"
  48. when:
  49. - override_system_hostname
  50. - ansible_distribution not in ['openSUSE Tumbleweed']
  51. - ansible_os_family not in ['CoreOS', 'Container Linux by CoreOS']
  52. - name: Assign inventory name to unconfigured hostnames (CoreOS and Tumbleweed only)
  53. command: "hostnamectl set-hostname {{inventory_hostname}}"
  54. register: hostname_changed
  55. when:
  56. - ansible_distribution in ['openSUSE Tumbleweed'] or ansible_os_family in ['CoreOS', 'Container Linux by CoreOS']
  57. - override_system_hostname
  58. - name: Update hostname fact (CoreOS and Tumbleweed only)
  59. setup:
  60. gather_subset: '!all'
  61. filter: ansible_hostname
  62. when:
  63. - hostname_changed.changed