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.

70 lines
2.0 KiB

[jjo] add DIND support to contrib/ (#3468) * [jjo] add DIND support to contrib/ - add contrib/dind with ansible playbook to create "node" containers, and setup them to mimic host nodes as much as possible (using Ubuntu images), see contrib/dind/README.md - nodes' /etc/hosts editing via `blockinfile` and `lineinfile` need `unsafe_writes: yes` because /etc/hosts are mounted by docker, and thus can't be handled atomically (modify copy + rename) * dind-host role: set node container hostname on creation * add "Resulting deployment" section with some CLI outputs * typo * selectable node_distro: debian, ubuntu * some fixes for node_distro: ubuntu * cpu optimization: add early `pkill -STOP agetty` * typo * add centos dind support ;) * add kubespray-dind.yaml, support fedora - add kubespray-dind.yaml (former custom.yaml at README.md) - rework README.md as per above - use some YAML power to share distros' commonality - add fedora support * create unique /etc/machine-id and other updates - create unique /etc/machine-id in each docker node, used as seed for e.g. weave mac addresses - with above, now netchecker 100% passes WoHooOO! :tada: :tada: :tada: - updated README.md output from (1.12.1, verified netcheck) * minor typos * fix centos node creation, needs earlier udevadm removal to avoid flaky facts, also verified netcheck Ok \o/ * add Q&D test-distros.sh, back to manual /etc/machine-id hack * run-test-distros.sh cosmetics and minor fixes * run-test-distros.sh: $rc fix and minor formatting changes * run-test-distros.sh output cosmetics
6 years ago
  1. - name: set_fact distro_setup
  2. set_fact:
  3. distro_setup: "{{ distro_settings[node_distro] }}"
  4. - name: set_fact other distro settings
  5. set_fact:
  6. distro_user: "{{ distro_setup['user'] }}"
  7. distro_ssh_service: "{{ distro_setup['ssh_service'] }}"
  8. distro_extra_packages: "{{ distro_setup['extra_packages'] }}"
  9. - name: Null-ify some linux tools to ease DIND
  10. file:
  11. src: "/bin/true"
  12. dest: "{{item}}"
  13. state: link
  14. force: yes
  15. with_items:
  16. # DIND box may have swap enable, don't bother
  17. - /sbin/swapoff
  18. # /etc/hosts handling would fail on trying to copy file attributes on edit,
  19. # void it by successfully returning nil output
  20. - /usr/bin/lsattr
  21. # disable selinux-isms, sp needed if running on non-Selinux host
  22. - /usr/sbin/semodule
  23. - name: Void installing dpkg docs and man pages on Debian based distros
  24. copy:
  25. content: |
  26. # Delete locales
  27. path-exclude=/usr/share/locale/*
  28. # Delete man pages
  29. path-exclude=/usr/share/man/*
  30. # Delete docs
  31. path-exclude=/usr/share/doc/*
  32. path-include=/usr/share/doc/*/copyright
  33. dest: /etc/dpkg/dpkg.cfg.d/01_nodoc
  34. when:
  35. - ansible_os_family == 'Debian'
  36. - name: Install system packages to better match a full-fledge node
  37. package:
  38. name: "{{ item }}"
  39. state: present
  40. with_items: "{{ distro_extra_packages }} + [ 'rsyslog', 'openssh-server' ]"
  41. - name: Start needed services
  42. service:
  43. name: "{{ item }}"
  44. state: started
  45. with_items:
  46. - rsyslog
  47. - "{{ distro_ssh_service }}"
  48. - name: Create distro user "{{distro_user}}"
  49. user:
  50. name: "{{ distro_user }}"
  51. uid: 1000
  52. #groups: sudo
  53. append: yes
  54. - name: Allow password-less sudo to "{{ distro_user }}"
  55. copy:
  56. content: "{{ distro_user }} ALL=(ALL) NOPASSWD:ALL"
  57. dest: "/etc/sudoers.d/{{ distro_user }}"
  58. - name: Add my pubkey to "{{ distro_user }}" user authorized keys
  59. authorized_key:
  60. user: "{{ distro_user }}"
  61. state: present
  62. key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"