echo "----> ansible-galaxy.sh"
+wget -q https://raw.githubusercontent.com/lfit/releng-global-jjb/master/jenkins-init-scripts/lf-env.sh \
+ -O ~/lf-env.sh
+
+# shellcheck disable=SC1090
+. ~/lf-env.sh
+
+lf-activate-venv --python python3 --venv-file "/tmp/.ansible_venv" \
+ ansible~=2.9.27
+
ansible_roles_path=${1:-.galaxy}
ansible_requirements_file=${2:-requirements.yaml}
script_dir=$(dirname "$0")
--- /dev/null
+#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2022 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+if command -v "$(cat /tmp/.ansible_venv)/bin/ansible-playbook" &> /dev/null; then
+ source "$(cat /tmp/.ansible_venv)/bin/activate" && ANSIBLE_FORCE_COLOR=1 \
+ PYTHONUNBUFFERED=1 "$(cat /tmp/.ansible_venv)/bin/ansible-playbook" "$@"
+elif command -v "$(which ansible-playbook)"; then
+ "$(which ansible-playbook)" "$@"
+else
+ echo "ERROR: ansible-playbook not found"
+ exit
+fi
Requirements
############
-* Ansible 2.4.1 or later
-* Packer 1.3.2 or later
+* Ansible 2.9.27 or later
+* Packer 1.8.2 or later
-Install Ansible via pip in a virtualenv if the version is not available via
-your local package manager.
+Install Ansible via pip in a virtualenv to build images.
.. code-block:: bash
- virtualenv ansible
- source ansible/bin/activate
- pip install ansible~=2.4.1
+ virtualenv -p $(which python3) ~/venv/.ansible
+ source ~/venv/.ansible/bin/activate
+ pip3 install ansible~=2.9.27
.. code-block:: bash
- pip install lftools[openstack]
- yum/apt install qemu-img
+ pip install lftools[openstack]
+ yum/apt install qemu-img
2. Fetch the image file in .img format
--- /dev/null
+---
+prelude: >
+ Install ansible and ansible-playbook using PyPI.
+issues:
+ - |
+ Error:
+ Problem: package ansible-5.4.0-3.el8.noarch requires
+ (ansible-core >= 2.12.2 with ansible-core < 2.13), but none
+ of the providers can be installed
+fixes:
+ - |
+ Install ansible through system packages causes dependencies
+ conflicts on CentOS 8 platform therefore update packer
+ templates to use ansible provisioner created through venv.
{
"type": "ansible",
"user": "{{user `ssh_user`}}",
+ "command": "./common-packer/ansible-playbook.sh",
"playbook_file": "provision/local-builder.yaml",
"ansible_env_vars": [
"ANSIBLE_NOCOWS=1",
},
{
"type": "ansible",
+ "command": "./common-packer/ansible-playbook.sh",
"playbook_file": "provision/local-builder.yaml",
"ansible_env_vars": [
"ANSIBLE_NOCOWS=1",
{
"type": "ansible",
"user": "{{user `ssh_user`}}",
+ "command": "./common-packer/ansible-playbook.sh",
"playbook_file": "provision/local-docker.yaml",
"ansible_env_vars": [
"ANSIBLE_NOCOWS=1",
},
{
"type": "ansible",
+ "command": "./common-packer/ansible-playbook.sh",
"playbook_file": "provision/local-docker.yaml",
"ansible_env_vars": [
"ANSIBLE_NOCOWS=1",