tools/provision: remove json_query usage from ansible playbooks
`json_query` requires python3-jmespath which, while available in the repos, it can sometimes cause issues when the ansible interpreter is different from the system interpreter. The `json_query` is only used in a handful of locations that can easily be served by `jq`, which we use in other places already.
This commit is contained in:
parent
5617a0744a
commit
93c0485531
3 changed files with 16 additions and 12 deletions
|
|
@ -43,12 +43,12 @@
|
||||||
|
|
||||||
# case: check ostree commit correctly updated
|
# case: check ostree commit correctly updated
|
||||||
- name: get deployed ostree commit
|
- name: get deployed ostree commit
|
||||||
command: rpm-ostree status --json
|
shell: rpm-ostree status --json | jq -r '.deployments[0].checksum'
|
||||||
register: result_commit
|
register: result_commit
|
||||||
|
|
||||||
- name: make a json result
|
- name: make a json result
|
||||||
set_fact:
|
set_fact:
|
||||||
deploy_commit: "{{ result_commit.stdout | from_json | json_query('deployments[0].checksum') }}"
|
deploy_commit: "{{ result_commit.stdout }}"
|
||||||
|
|
||||||
- name: check commit deployed and built
|
- name: check commit deployed and built
|
||||||
block:
|
block:
|
||||||
|
|
@ -468,12 +468,12 @@
|
||||||
- name: check ostree commit after rollback
|
- name: check ostree commit after rollback
|
||||||
block:
|
block:
|
||||||
- name: check ostree commit after rollback
|
- name: check ostree commit after rollback
|
||||||
command: rpm-ostree status --json
|
shell: rpm-ostree status --json | jq -r '.deployments[0].checksum'
|
||||||
register: result_commit
|
register: result_commit
|
||||||
|
|
||||||
- name: make a json result
|
- name: make a json result
|
||||||
set_fact:
|
set_fact:
|
||||||
deploy_commit: "{{ result_commit.stdout | from_json | json_query('deployments[0].checksum') }}"
|
deploy_commit: "{{ result_commit.stdout }}"
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,12 @@
|
||||||
|
|
||||||
# case: check ostree commit correctly updated
|
# case: check ostree commit correctly updated
|
||||||
- name: get deployed ostree commit
|
- name: get deployed ostree commit
|
||||||
command: rpm-ostree status --json
|
shell: rpm-ostree status --json | jq -r '.deployments[0].checksum'
|
||||||
register: result_commit
|
register: result_commit
|
||||||
|
|
||||||
- name: make a json result
|
- name: make a json result
|
||||||
set_fact:
|
set_fact:
|
||||||
deploy_commit: "{{ result_commit.stdout | from_json | json_query('deployments[0].checksum') }}"
|
deploy_commit: "{{ result_commit.stdout }}"
|
||||||
|
|
||||||
- name: check commit deployed and built
|
- name: check commit deployed and built
|
||||||
block:
|
block:
|
||||||
|
|
@ -451,12 +451,12 @@
|
||||||
- name: check ostree commit after rollback
|
- name: check ostree commit after rollback
|
||||||
block:
|
block:
|
||||||
- name: check ostree commit after rollback
|
- name: check ostree commit after rollback
|
||||||
command: rpm-ostree status --json
|
shell: rpm-ostree status --json | jq -r '.deployments[0].checksum'
|
||||||
register: result_commit
|
register: result_commit
|
||||||
|
|
||||||
- name: make a json result
|
- name: make a json result
|
||||||
set_fact:
|
set_fact:
|
||||||
deploy_commit: "{{ result_commit.stdout | from_json | json_query('deployments[0].checksum') }}"
|
deploy_commit: "{{ result_commit.stdout }}"
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,15 @@ elif [[ $ID == rhel || $ID == centos ]] && [[ ${VERSION_ID%.*} == 9 ]]; then
|
||||||
curl -LO --insecure https://hdn.corp.redhat.com/rhel8-csb/RPMS/noarch/redhat-internal-cert-install-0.1-23.el7.csb.noarch.rpm
|
curl -LO --insecure https://hdn.corp.redhat.com/rhel8-csb/RPMS/noarch/redhat-internal-cert-install-0.1-23.el7.csb.noarch.rpm
|
||||||
sudo dnf install -y ./redhat-internal-cert-install-0.1-23.el7.csb.noarch.rpm dnf-plugins-core
|
sudo dnf install -y ./redhat-internal-cert-install-0.1-23.el7.csb.noarch.rpm dnf-plugins-core
|
||||||
sudo dnf copr enable -y copr.devel.redhat.com/osbuild-team/epel-el9 "rhel-9.dev-$ARCH"
|
sudo dnf copr enable -y copr.devel.redhat.com/osbuild-team/epel-el9 "rhel-9.dev-$ARCH"
|
||||||
# jmespath required for json_query
|
fi
|
||||||
sudo dnf install -y ansible-core koji python3-jmespath
|
|
||||||
|
|
||||||
# json_query filter, used in our ansible playbooks, was moved to the
|
# RHEL 8.6+ and CentOS 9 require different handling for ansible
|
||||||
# 'community.general' collection
|
ge86=$(echo "${VERSION_ID}" | awk '{print $1 >= 8.6}') # do a numerical comparison for the version
|
||||||
|
echo -n "${ID}=${VERSION_ID} "
|
||||||
|
if [[ "${ID}" == "rhel" || "${ID}" == "centos" ]] && (( ge86 )); then
|
||||||
|
sudo dnf install -y ansible-core koji
|
||||||
|
|
||||||
|
# NOTE: do we need this?
|
||||||
sudo ansible-galaxy collection install community.general
|
sudo ansible-galaxy collection install community.general
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue