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.

107 lines
3.5 KiB

Upgrade ansible (#10190) * project: update all dependencies including ansible Upgrade to ansible 7.x and ansible-core 2.14.x. There seems to be issue with ansible 8/ansible-core 2.15 so we remain on those versions for now. It's quite a big bump already anyway. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: install aws galaxy collection Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * ansible-lint: disable various rules after ansible upgrade Temporarily disable a bunch of linting action following ansible upgrade. Those should be taken care of separately. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve deprecated-module ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve no-free-form ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[meta] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[playbook] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[tasks] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-file-permissions ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-shell-pipe ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: remove deprecated warn args Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use fqcn for non builtin tasks Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve syntax-check[missing-file] for contrib playbook Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use arithmetic inside jinja to fix ansible 6 upgrade Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
1 year ago
Upgrade ansible (#10190) * project: update all dependencies including ansible Upgrade to ansible 7.x and ansible-core 2.14.x. There seems to be issue with ansible 8/ansible-core 2.15 so we remain on those versions for now. It's quite a big bump already anyway. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: install aws galaxy collection Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * ansible-lint: disable various rules after ansible upgrade Temporarily disable a bunch of linting action following ansible upgrade. Those should be taken care of separately. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve deprecated-module ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve no-free-form ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[meta] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[playbook] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[tasks] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-file-permissions ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-shell-pipe ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: remove deprecated warn args Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use fqcn for non builtin tasks Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve syntax-check[missing-file] for contrib playbook Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use arithmetic inside jinja to fix ansible 6 upgrade Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
1 year ago
  1. ---
  2. - name: Kubernetes Apps | Download yq
  3. include_tasks: "../../../download/tasks/download_file.yml"
  4. vars:
  5. download: "{{ download_defaults | combine(downloads.yq) }}"
  6. - name: Kubernetes Apps | Copy yq binary from download dir
  7. ansible.posix.synchronize:
  8. src: "{{ downloads.yq.dest }}"
  9. dest: "{{ bin_dir }}/yq"
  10. compress: false
  11. perms: true
  12. owner: false
  13. group: false
  14. delegate_to: "{{ inventory_hostname }}"
  15. - name: Kubernetes Apps | Set ArgoCD template list
  16. set_fact:
  17. argocd_templates:
  18. - name: namespace
  19. file: argocd-namespace.yml
  20. - name: install
  21. file: argocd-install.yml
  22. namespace: "{{ argocd_namespace }}"
  23. url: "{{ argocd_install_url }}"
  24. when:
  25. - "inventory_hostname == groups['kube_control_plane'][0]"
  26. - name: Kubernetes Apps | Download ArgoCD remote manifests
  27. include_tasks: "../../../download/tasks/download_file.yml"
  28. vars:
  29. download_argocd:
  30. enabled: "{{ argocd_enabled }}"
  31. file: true
  32. dest: "{{ local_release_dir }}/{{ item.file }}"
  33. url: "{{ item.url }}"
  34. unarchive: false
  35. owner: "root"
  36. mode: "0644"
  37. sha256: ""
  38. download: "{{ download_defaults | combine(download_argocd) }}"
  39. with_items: "{{ argocd_templates | selectattr('url', 'defined') | list }}"
  40. loop_control:
  41. label: "{{ item.file }}"
  42. when:
  43. - "inventory_hostname == groups['kube_control_plane'][0]"
  44. - name: Kubernetes Apps | Copy ArgoCD remote manifests from download dir
  45. ansible.posix.synchronize:
  46. src: "{{ local_release_dir }}/{{ item.file }}"
  47. dest: "{{ kube_config_dir }}/{{ item.file }}"
  48. compress: false
  49. perms: true
  50. owner: false
  51. group: false
  52. delegate_to: "{{ inventory_hostname }}"
  53. with_items: "{{ argocd_templates | selectattr('url', 'defined') | list }}"
  54. when:
  55. - "inventory_hostname == groups['kube_control_plane'][0]"
  56. - name: Kubernetes Apps | Set ArgoCD namespace for remote manifests
  57. become: true
  58. command: |
  59. {{ bin_dir }}/yq eval-all -i '.metadata.namespace="{{ argocd_namespace }}"' {{ kube_config_dir }}/{{ item.file }}
  60. with_items: "{{ argocd_templates | selectattr('url', 'defined') | list }}"
  61. loop_control:
  62. label: "{{ item.file }}"
  63. when:
  64. - "inventory_hostname == groups['kube_control_plane'][0]"
  65. - name: Kubernetes Apps | Create ArgoCD manifests from templates
  66. become: true
  67. template:
  68. src: "{{ item.file }}.j2"
  69. dest: "{{ kube_config_dir }}/{{ item.file }}"
  70. mode: "0644"
  71. with_items: "{{ argocd_templates | selectattr('url', 'undefined') | list }}"
  72. loop_control:
  73. label: "{{ item.file }}"
  74. when:
  75. - "inventory_hostname == groups['kube_control_plane'][0]"
  76. - name: Kubernetes Apps | Install ArgoCD
  77. become: true
  78. kube:
  79. name: ArgoCD
  80. kubectl: "{{ bin_dir }}/kubectl"
  81. filename: "{{ kube_config_dir }}/{{ item.file }}"
  82. state: latest
  83. with_items: "{{ argocd_templates }}"
  84. when:
  85. - "inventory_hostname == groups['kube_control_plane'][0]"
  86. # https://github.com/argoproj/argo-cd/blob/master/docs/faq.md#i-forgot-the-admin-password-how-do-i-reset-it
  87. - name: Kubernetes Apps | Set ArgoCD custom admin password
  88. become: true
  89. shell: |
  90. {{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf -n {{ argocd_namespace }} patch secret argocd-secret -p \
  91. '{
  92. "stringData": {
  93. "admin.password": "{{ argocd_admin_password | password_hash('bcrypt') }}",
  94. "admin.passwordMtime": "'$(date +%FT%T%Z)'"
  95. }
  96. }'
  97. when:
  98. - argocd_admin_password is defined
  99. - "inventory_hostname == groups['kube_control_plane'][0]"