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.

87 lines
2.0 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: Ensure NTP package
  3. package:
  4. name:
  5. - "{{ ntp_package }}"
  6. state: present
  7. when:
  8. - not is_fedora_coreos
  9. - not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
  10. - name: Disable systemd-timesyncd
  11. service:
  12. name: systemd-timesyncd.service
  13. enabled: false
  14. state: stopped
  15. failed_when: false
  16. - name: Set fact NTP settings
  17. set_fact:
  18. # noqa: jinja[spacing]
  19. ntp_config_file: >-
  20. {% if ntp_package == "ntp" -%}
  21. /etc/ntp.conf
  22. {%- elif ansible_os_family in ['RedHat', 'Suse'] -%}
  23. /etc/chrony.conf
  24. {%- else -%}
  25. /etc/chrony/chrony.conf
  26. {%- endif -%}
  27. # noqa: jinja[spacing]
  28. ntp_service_name: >-
  29. {% if ntp_package == "chrony" -%}
  30. chronyd
  31. {%- elif ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk", "RedHat", "Suse"] -%}
  32. ntpd
  33. {%- else -%}
  34. ntp
  35. {%- endif %}
  36. - name: Generate NTP configuration file.
  37. template:
  38. src: "{{ ntp_config_file | basename }}.j2"
  39. dest: "{{ ntp_config_file }}"
  40. mode: "0644"
  41. notify: Preinstall | restart ntp
  42. when:
  43. - ntp_manage_config
  44. - name: Stop the NTP Deamon For Sync Immediately # `ntpd -gq`,`chronyd -q` requires the ntp daemon stop
  45. service:
  46. name: "{{ ntp_service_name }}"
  47. state: stopped
  48. when:
  49. - ntp_force_sync_immediately
  50. - name: Force Sync NTP Immediately
  51. # noqa: jinja[spacing]
  52. command: >-
  53. timeout -k 60s 60s
  54. {% if ntp_package == "ntp" -%}
  55. ntpd -gq
  56. {%- else -%}
  57. chronyd -q
  58. {%- endif -%}
  59. when:
  60. - ntp_force_sync_immediately
  61. - name: Ensure NTP service is started and enabled
  62. service:
  63. name: "{{ ntp_service_name }}"
  64. state: started
  65. enabled: true
  66. - name: Ensure tzdata package
  67. package:
  68. name:
  69. - tzdata
  70. state: present
  71. when:
  72. - ntp_timezone
  73. - not is_fedora_coreos
  74. - not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
  75. - name: Set timezone
  76. community.general.timezone:
  77. name: "{{ ntp_timezone }}"
  78. when:
  79. - ntp_timezone