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.

96 lines
3.0 KiB

  1. ---
  2. # Role commun a toutes les machines
  3. # vars: admin_ssh_keys, repositories, default_packages, ntp_servers, description
  4. # Bootstrap if necessary (install python-apt)
  5. - name: Bootstrap if necessary
  6. tags: bootstrap
  7. raw: python -c "import apt" || DEBIAN_FRONTEND=noninteractive apt-get --force-yes -y install python-apt
  8. when: ansible_distribution == 'Debian'
  9. # Check mandatory variables
  10. - name: Check vars
  11. fail: msg="Missing variable default_packages_debian"
  12. when: default_packages_debian is not defined
  13. - name: Check vars
  14. fail: msg="Missing variable description"
  15. when: description is not defined
  16. - name: Check vars
  17. fail: msg="Missing variable ntp_servers"
  18. when: ntp_servers is not defined
  19. - name: Check vars
  20. fail: msg="Missing variable disable_ipv6"
  21. when: disable_ipv6 is not defined
  22. # Packages
  23. - name: Install default packages Debian.
  24. apt: pkg={{item}} state=latest update_cache=yes
  25. with_items: "{{ default_packages_debian }}"
  26. when: ansible_distribution == 'Debian'
  27. # Configure NTP
  28. - name: Configure NTP
  29. tags: ntp
  30. template: src=etc-ntp.conf.j2 dest=/etc/ntp.conf
  31. # Basic Shell & vim configuration
  32. - name: Create .vim/colors
  33. tags: custom
  34. file: path=/root/.vim/colors state=directory
  35. - name: Custom .bashrc, .vimrc, .inputrc and Wombat vim colors theme
  36. tags: custom
  37. copy: src={{ item.src }} dest={{ item.dest }}
  38. with_items:
  39. - { src: 'root-.bashrc', dest: '/root/.bashrc' }
  40. - { src: 'root-.vimrc', dest: '/root/.vimrc' }
  41. - { src: 'root-.inputrc', dest: '/root/.inputrc' }
  42. - { src: 'root-.vim-colors-wombat.vim', dest: '/root/.vim/colors/wombat.vim' }
  43. # Set motd and README.root
  44. - name: Set the motd
  45. tags: custom
  46. template: src=etc-motd.j2 dest=/etc/motd
  47. - name: Modify /root/.profile, Add basic README.root
  48. tags: custom
  49. copy: src={{ item.src }} dest={{ item.dest }}
  50. with_items:
  51. - { src: 'root-.profile', dest: '/root/.profile' }
  52. - { src: 'root-README.root', dest: '/root/README.root' }
  53. when: initialize == 'True'
  54. # Env setup
  55. - name: Set the locale
  56. tags: environ
  57. debconf: name=locales question='default_environment_locale' value='fr_FR.UTF-8' vtype='multiselect'
  58. debconf: name=locales question='locales_to_be_generated' value='en_US.UTF-8 UTF-8, fr_FR.UTF-8 UTF-8' vtype='multiselect'
  59. debconf: name=locales question='locales/locales_to_be_generated' value='fr_FR.UTF-8, UTF-8' vtype='multiselect'
  60. when: ansible_distribution == 'Debian'
  61. - name: Set timezone
  62. copy: content='{{ tzdata_timezone | default('Europe/Paris') }}'
  63. dest=/etc/timezone owner=root group=root mode=0644
  64. notify:
  65. - update timezone
  66. when: ansible_distribution == 'Debian'
  67. - name: Disable IPv6 (need reboot)
  68. tags: environ
  69. lineinfile: dest=/etc/modprobe.d/blacklist line="blacklist ipv6" state="present" create="yes"
  70. when: disable_ipv6
  71. - name: Enable IPv6 (need reboot)
  72. tags: environ
  73. lineinfile: dest=/etc/modprobe.d/blacklist line="blacklist ipv6" state="absent" create="yes"
  74. when: not disable_ipv6
  75. # vim: set textwidth=0 ft=yaml ts=2 sw=2 expandtab: