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.

61 lines
1.7 KiB

9 years ago
9 years ago
  1. ---
  2. - name: ensure dnsmasq.d directory exists
  3. file:
  4. path: /etc/dnsmasq.d
  5. state: directory
  6. tags: bootstrap-os
  7. - name: ensure dnsmasq.d-available directory exists
  8. file:
  9. path: /etc/dnsmasq.d-available
  10. state: directory
  11. tags: bootstrap-os
  12. - name: Write dnsmasq configuration
  13. template:
  14. src: 01-kube-dns.conf.j2
  15. dest: /etc/dnsmasq.d-available/01-kube-dns.conf
  16. mode: 0755
  17. backup: yes
  18. - name: Stat dnsmasq configuration
  19. stat: path=/etc/dnsmasq.d/01-kube-dns.conf
  20. register: sym
  21. - name: Move previous configuration
  22. command: mv /etc/dnsmasq.d/01-kube-dns.conf /etc/dnsmasq.d-available/01-kube-dns.conf.bak
  23. changed_when: False
  24. when: sym.stat.islnk is defined and sym.stat.islnk == False
  25. - name: Enable dnsmasq configuration
  26. file:
  27. src: /etc/dnsmasq.d-available/01-kube-dns.conf
  28. dest: /etc/dnsmasq.d/01-kube-dns.conf
  29. state: link
  30. - name: Create dnsmasq manifests
  31. template: src={{item.file}} dest={{kube_config_dir}}/{{item.file}}
  32. with_items:
  33. - {file: dnsmasq-ds.yml, type: ds}
  34. - {file: dnsmasq-svc.yml, type: svc}
  35. register: manifests
  36. when: inventory_hostname == groups['kube-master'][0]
  37. - name: Start Resources
  38. kube:
  39. name: dnsmasq
  40. namespace: "{{system_namespace}}"
  41. kubectl: "{{bin_dir}}/kubectl"
  42. resource: "{{item.item.type}}"
  43. filename: "{{kube_config_dir}}/{{item.item.file}}"
  44. state: "{{item.changed | ternary('latest','present') }}"
  45. with_items: "{{ manifests.results }}"
  46. when: inventory_hostname == groups['kube-master'][0]
  47. - name: Check for dnsmasq port (pulling image and running container)
  48. wait_for:
  49. host: "{{dns_server}}"
  50. port: 53
  51. delay: 5
  52. when: inventory_hostname == groups['kube-node'][0]
  53. tags: facts