Moving to ansible 2.9

Some code changes were necessary since the Ansible-provided jinja tests
as filters was removed in ansible 2.9, see [1]

[1] https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_2.5.html#jinja-tests-used-as-filters

Co-authored-by: Kaio Oliveira <kaio.kassiano.oliveira@gmail.com>
Change-Id: I2f1c2ece0543eb60ac5ac5f9ad1465ffd2d66592
This commit is contained in:
Iury Gregory Melo Ferreira 2020-06-04 10:29:59 +02:00
parent 508899cc6b
commit 9c9c014908
6 changed files with 18 additions and 12 deletions

View File

@ -60,7 +60,6 @@
- name: Setting MySQL socket fact
set_fact:
mysql_socket_path: "/var/{% if ansible_os_family | lower == 'redhat' %}lib{% else %}run{% endif %}/{% if ansible_os_family | lower == 'debian' %}mysqld/mysqld.sock{% else %}mysql/mysql.sock{% endif %}"
when: ansible_version.full is version_compare('2.6.5', '>=')
- name: "MySQL - Creating DB"
mysql_db:

View File

@ -36,13 +36,13 @@
- name: "Extract IPA kernel checksum"
shell: awk '/{{ ipa_kernel_upstream_url | basename }}/{print $1}' "{{ ipa_kernel }}.{{ ipa_kernel_upstream_checksum_algo }}"
register: parsed_ipa_kernel_checksum
when: not ipa_kernel_checksum_result|failed
when: not ipa_kernel_checksum_result is failed
- fail:
msg: "Failed to extract checksum for {{ ipa_kernel_upstream_url | basename }}"
when: not ipa_kernel_checksum_result|failed and parsed_ipa_kernel_checksum.stdout == ""
when: not ipa_kernel_checksum_result is failed and parsed_ipa_kernel_checksum.stdout == ""
- set_fact:
ipa_kernel_checksum: "{{ ipa_kernel_upstream_checksum_algo }}:{{ parsed_ipa_kernel_checksum.stdout }}"
when: not ipa_kernel_checksum_result|failed
when: not ipa_kernel_checksum_result is failed
when: ipa_kernel_upstream_checksum_url != ""
- name: "Download IPA kernel"
@ -55,7 +55,7 @@
force: yes
register: ipa_kernel_download_done
until: ipa_kernel_download_done is succeeded or
(ipa_kernel_download_done|failed)
(ipa_kernel_download_done is failed)
retries: 5
delay: 10
environment: "{{ venv }}"
@ -79,13 +79,13 @@
- name: "Extract IPA ramdisk checksum"
shell: awk '/{{ ipa_ramdisk_upstream_url | basename }}/{print $1}' "{{ ipa_ramdisk }}.{{ ipa_ramdisk_upstream_checksum_algo }}"
register: parsed_ipa_ramdisk_checksum
when: not ipa_ramdisk_checksum_result|failed
when: not ipa_ramdisk_checksum_result is failed
- fail:
msg: "Failed to extract checksum for {{ ipa_ramdisk_upstream_url | basename }}"
when: not ipa_ramdisk_checksum_result|failed and parsed_ipa_ramdisk_checksum.stdout == ""
when: not ipa_ramdisk_checksum_result is failed and parsed_ipa_ramdisk_checksum.stdout == ""
- set_fact:
ipa_ramdisk_checksum: "{{ ipa_ramdisk_upstream_checksum_algo }}:{{ parsed_ipa_ramdisk_checksum.stdout }}"
when: not ipa_ramdisk_checksum_result|failed
when: not ipa_ramdisk_checksum_result is failed
when: ipa_ramdisk_upstream_checksum_url != ""
- name: "Download IPA image"
@ -98,7 +98,7 @@
force: yes
register: ipa_ramdisk_download_done
until: ipa_ramdisk_download_done is succeeded or
(ipa_ramdisk_download_done|failed and ipa_ramdisk_download_done.status_code is defined and ipa_ramdisk_download_done.status_code == 404)
(ipa_ramdisk_download_done is failed and ipa_ramdisk_download_done.status_code is defined and ipa_ramdisk_download_done.status_code == 404)
retries: 5
delay: 10
environment: "{{ venv }}"

View File

@ -16,7 +16,6 @@
- name: Setting MySQL socket fact
set_fact:
mysql_socket_path: "/var/{% if ansible_os_family | lower == 'redhat' %}lib{% else %}run{% endif %}/{% if ansible_os_family | lower == 'debian' %}mysqld/mysqld.sock{% else %}mysql/mysql.sock{% endif %}"
when: ansible_version.full is version_compare('2.6.5', '>=')
- name: "MySQL - Create database"
mysql_db:

View File

@ -49,7 +49,6 @@
- name: Setting MySQL socket fact
set_fact:
mysql_socket_path: "/var/{% if ansible_os_family | lower == 'redhat' %}lib{% else %}run{% endif %}/{% if ansible_os_family | lower == 'debian' %}mysqld/mysqld.sock{% else %}mysql/mysql.sock{% endif %}"
when: ansible_version.full is version_compare('2.6.5', '>=')
- name: "MySQL - Creating DB"
mysql_db:

View File

@ -0,0 +1,9 @@
---
features:
- |
Changes the default version of Ansible to version 2.9.
upgrade:
- |
The default version of Ansible used for this release of bifrost is version
2.9. Operators may wish to upgrade if they are directly invoking playbooks
or roles.

View File

@ -5,7 +5,7 @@ set -eu
# NOTE(pas-ha) the above exports some useful variables like
# $PYTHON , $PIP and $VENV depending on venv install or not
DEFAULT_PIP_ANSIBLE='!=2.8.9,<2.9'
DEFAULT_PIP_ANSIBLE='>=2.9,<2.10'
ANSIBLE_PIP_VERSION=${ANSIBLE_PIP_VERSION:-${DEFAULT_PIP_ANSIBLE}}
ANSIBLE_SOURCE_PATH=${ANSIBLE_SOURCE_PATH:-ansible${ANSIBLE_PIP_VERSION}}