main.yaml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. ---
  2. - name: setup firewall
  3. include: firewall.yml
  4. static: yes
  5. - name: Set the Nuage certificate directory fact for Atomic hosts
  6. set_fact:
  7. cert_output_dir: /var/usr/share/nuage-openshift-monitor
  8. when: openshift.common.is_atomic | bool
  9. - name: Set the Nuage kubeconfig file path fact for Atomic hosts
  10. set_fact:
  11. kube_config: /var/usr/share/nuage-openshift-monitor/nuage.kubeconfig
  12. when: openshift.common.is_atomic | bool
  13. - name: Set the Nuage monitor yaml location fact for Atomic hosts
  14. set_fact:
  15. kubemon_yaml: /var/usr/share/nuage-openshift-monitor/nuage-openshift-monitor.yaml
  16. when: openshift.common.is_atomic | bool
  17. - name: Set the Nuage monitor certs location fact for Atomic hosts
  18. set_fact:
  19. nuage_master_crt_dir: /var/usr/share/nuage-openshift-monitor/
  20. when: openshift.common.is_atomic | bool
  21. - name: Set the Nuage master config directory for daemon sets install
  22. set_fact:
  23. nuage_master_config_dsets_mount_dir: /var/usr/share/
  24. when: master_host_type == "is_atomic"
  25. - name: Set the Nuage node config directory for daemon sets install
  26. set_fact:
  27. nuage_node_config_dsets_mount_dir: /var/usr/share/
  28. when: slave_host_type == "is_atomic"
  29. - name: Set the Nuage CNI plugin binary directory for daemon sets install
  30. set_fact:
  31. nuage_cni_bin_dsets_mount_dir: /var/opt/cni/bin
  32. when: openshift.common.is_atomic | bool
  33. - name: Create directory /usr/share/nuage-openshift-monitor
  34. become: yes
  35. file: path=/usr/share/nuage-openshift-monitor state=directory
  36. when: not openshift.common.is_atomic | bool
  37. - name: Create directory /var/usr/share/nuage-openshift-monitor
  38. become: yes
  39. file: path=/var/usr/share/nuage-openshift-monitor state=directory
  40. when: openshift.common.is_atomic | bool
  41. - name: Create directory /var/usr/bin for monitor binary on atomic
  42. become: yes
  43. file: path=/var/usr/bin state=directory
  44. when: openshift.common.is_atomic | bool
  45. - name: Create CNI bin directory /var/opt/cni/bin
  46. become: yes
  47. file: path=/var/opt/cni/bin state=directory
  48. when: openshift.common.is_atomic | bool
  49. - name: Create the log directory
  50. become: yes
  51. file: path={{ nuage_mon_rest_server_logdir }} state=directory
  52. - include: serviceaccount.yml
  53. - name: Download the certs and keys
  54. become: yes
  55. fetch: src={{ cert_output_dir }}/{{ item }} dest=/tmp/{{ item }} flat=yes
  56. with_items:
  57. - ca.crt
  58. - nuage.crt
  59. - nuage.key
  60. - nuage.kubeconfig
  61. - name: Copy the certificates and keys
  62. become: yes
  63. copy: src="/tmp/{{ item }}" dest="{{ cert_output_dir }}/{{ item }}"
  64. with_items:
  65. - ca.crt
  66. - nuage.crt
  67. - nuage.key
  68. - nuage.kubeconfig
  69. - include: certificates.yml
  70. - name: Install Nuage VSD user certificate
  71. become: yes
  72. copy: src="{{ vsd_user_cert_file }}" dest="{{ cert_output_dir }}/{{ vsd_user_cert_file | basename }}"
  73. - name: Install Nuage VSD user key
  74. become: yes
  75. copy: src="{{ vsd_user_key_file }}" dest="{{ cert_output_dir }}/{{ vsd_user_key_file | basename }}"
  76. - name: Create Nuage master daemon set yaml file
  77. become: yes
  78. template: src=nuage-master-config-daemonset.j2 dest=/etc/nuage-master-config-daemonset.yaml owner=root mode=0644
  79. - name: Create Nuage node daemon set yaml file
  80. become: yes
  81. template: src=nuage-node-config-daemonset.j2 dest=/etc/nuage-node-config-daemonset.yaml owner=root mode=0644
  82. - name: Add the service account to the privileged scc to have root permissions
  83. shell: oc adm policy add-scc-to-user privileged system:serviceaccount:openshift-infra:daemonset-controller
  84. ignore_errors: true
  85. when: inventory_hostname == groups.oo_first_master.0
  86. - name: Spawn Nuage Master monitor daemon sets pod
  87. shell: oc create -f /etc/nuage-master-config-daemonset.yaml
  88. ignore_errors: true
  89. when: inventory_hostname == groups.oo_first_master.0
  90. - name: Spawn Nuage CNI daemon sets pod
  91. shell: oc create -f /etc/nuage-node-config-daemonset.yaml
  92. ignore_errors: true
  93. when: inventory_hostname == groups.oo_first_master.0
  94. - name: Restart daemons
  95. command: /bin/true
  96. notify:
  97. - restart master api
  98. - restart master controllers
  99. ignore_errors: true