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.

71 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
[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
[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. ---
  2. - name: set_fact distro_setup
  3. set_fact:
  4. distro_setup: "{{ distro_settings[node_distro] }}"
  5. - name: set_fact other distro settings
  6. set_fact:
  7. distro_user: "{{ distro_setup['user'] }}"
  8. distro_ssh_service: "{{ distro_setup['ssh_service'] }}"
  9. distro_extra_packages: "{{ distro_setup['extra_packages'] }}"
  10. - name: Null-ify some linux tools to ease DIND
  11. file:
  12. src: "/bin/true"
  13. dest: "{{item}}"
  14. state: link
  15. force: yes
  16. with_items:
  17. # DIND box may have swap enable, don't bother
  18. - /sbin/swapoff
  19. # /etc/hosts handling would fail on trying to copy file attributes on edit,
  20. # void it by successfully returning nil output
  21. - /usr/bin/lsattr
  22. # disable selinux-isms, sp needed if running on non-Selinux host
  23. - /usr/sbin/semodule
  24. - name: Void installing dpkg docs and man pages on Debian based distros
  25. copy:
  26. content: |
  27. # Delete locales
  28. path-exclude=/usr/share/locale/*
  29. # Delete man pages
  30. path-exclude=/usr/share/man/*
  31. # Delete docs
  32. path-exclude=/usr/share/doc/*
  33. path-include=/usr/share/doc/*/copyright
  34. dest: /etc/dpkg/dpkg.cfg.d/01_nodoc
  35. when:
  36. - ansible_os_family == 'Debian'
  37. - name: Install system packages to better match a full-fledge node
  38. package:
  39. name: "{{ item }}"
  40. state: present
  41. with_items: "{{ distro_extra_packages }} + [ 'rsyslog', 'openssh-server' ]"
  42. - name: Start needed services
  43. service:
  44. name: "{{ item }}"
  45. state: started
  46. with_items:
  47. - rsyslog
  48. - "{{ distro_ssh_service }}"
  49. - name: Create distro user "{{distro_user}}"
  50. user:
  51. name: "{{ distro_user }}"
  52. uid: 1000
  53. # groups: sudo
  54. append: yes
  55. - name: Allow password-less sudo to "{{ distro_user }}"
  56. copy:
  57. content: "{{ distro_user }} ALL=(ALL) NOPASSWD:ALL"
  58. dest: "/etc/sudoers.d/{{ distro_user }}"
  59. - name: Add my pubkey to "{{ distro_user }}" user authorized keys
  60. authorized_key:
  61. user: "{{ distro_user }}"
  62. state: present
  63. key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"