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.

81 lines
2.9 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
  1. ---
  2. - name: Provision Google Cloud VMs
  3. hosts: localhost
  4. become: false
  5. gather_facts: no
  6. vars:
  7. cloud_machine_type: g1-small
  8. mode: default
  9. preemptible: no
  10. ci_job_name: "{{ lookup('env', 'CI_JOB_NAME') }}"
  11. delete_group_vars: no
  12. tasks:
  13. - name: Include vars for test {{ ci_job_name }}
  14. include_vars: "../files/{{ ci_job_name }}.yml"
  15. - name: Replace_test_id
  16. set_fact:
  17. test_name: "{{ test_id | regex_replace('\\.', '-') }}"
  18. - name: Set instance names
  19. set_fact:
  20. # noqa: jinja[spacing]
  21. instance_names: >-
  22. {%- if mode in ['separate', 'separate-scale', 'ha', 'ha-scale'] -%}
  23. k8s-{{ test_name }}-1,k8s-{{ test_name }}-2,k8s-{{ test_name }}-3
  24. {%- elif mode == 'all-in-one' -%}
  25. k8s-{{ test_name }}-1
  26. {%- else -%}
  27. k8s-{{ test_name }}-1,k8s-{{ test_name }}-2
  28. {%- endif -%}
  29. - name: Create gce instances
  30. google.cloud.gcp_compute_instance: # noqa args[module] - Probably doesn't work
  31. instance_names: "{{ instance_names }}"
  32. machine_type: "{{ cloud_machine_type }}"
  33. image: "{{ cloud_image | default(omit) }}"
  34. image_family: "{{ cloud_image_family | default(omit) }}"
  35. preemptible: "{{ preemptible }}"
  36. service_account_email: "{{ gce_service_account_email }}"
  37. pem_file: "{{ gce_pem_file | default(omit) }}"
  38. credentials_file: "{{ gce_credentials_file | default(omit) }}"
  39. project_id: "{{ gce_project_id }}"
  40. zone: "{{ cloud_region }}"
  41. metadata: '{"test_id": "{{ test_id }}", "network": "{{ kube_network_plugin }}", "startup-script": "{{ startup_script | default("") }}"}'
  42. tags: "build-{{ test_name }},{{ kube_network_plugin }}"
  43. ip_forward: yes
  44. service_account_permissions: ['compute-rw']
  45. register: gce
  46. - name: Add instances to host group
  47. add_host:
  48. hostname: "{{ item.public_ip }}"
  49. groupname: "waitfor_hosts"
  50. with_items: '{{ gce.instance_data }}'
  51. - name: Template the inventory # noqa no-relative-paths - CI inventory templates are not in role_path
  52. template:
  53. src: ../templates/inventory-gce.j2
  54. dest: "{{ inventory_path }}"
  55. mode: 0644
  56. - name: Make group_vars directory
  57. file:
  58. path: "{{ inventory_path | dirname }}/group_vars"
  59. state: directory
  60. mode: 0755
  61. when: mode in ['scale', 'separate-scale', 'ha-scale']
  62. - name: Template fake hosts group vars # noqa no-relative-paths - CI templates are not in role_path
  63. template:
  64. src: ../templates/fake_hosts.yml.j2
  65. dest: "{{ inventory_path | dirname }}/group_vars/fake_hosts.yml"
  66. mode: 0644
  67. when: mode in ['scale', 'separate-scale', 'ha-scale']
  68. - name: Delete group_vars directory
  69. file:
  70. path: "{{ inventory_path | dirname }}/group_vars"
  71. state: absent
  72. recurse: yes
  73. when: delete_group_vars