diff --git a/awx/api/templates/instance_install_bundle/group_vars/all.yml b/awx/api/templates/instance_install_bundle/group_vars/all.yml index cac161cf02..ac595003c5 100644 --- a/awx/api/templates/instance_install_bundle/group_vars/all.yml +++ b/awx/api/templates/instance_install_bundle/group_vars/all.yml @@ -4,12 +4,16 @@ receptor_group: awx receptor_verify: true receptor_tls: true receptor_mintls13: false +{% if instance.node_type == "execution" %} receptor_work_commands: ansible-runner: command: ansible-runner params: worker allowruntimeparams: true verifysignature: true +additional_python_packages: + - ansible-runner +{% endif %} custom_worksign_public_keyfile: receptor/work_public_key.pem custom_tls_certfile: receptor/tls/receptor.crt custom_tls_keyfile: receptor/tls/receptor.key @@ -29,8 +33,6 @@ receptor_peers: protocol: tcp {% endfor %} {% endif %} -additional_python_packages: - - ansible-runner {% verbatim %} podman_user: "{{ receptor_user }}" podman_group: "{{ receptor_group }}" diff --git a/awx/api/templates/instance_install_bundle/install_receptor.yml b/awx/api/templates/instance_install_bundle/install_receptor.yml index d55b915fb5..6079f0c712 100644 --- a/awx/api/templates/instance_install_bundle/install_receptor.yml +++ b/awx/api/templates/instance_install_bundle/install_receptor.yml @@ -9,6 +9,8 @@ shell: /bin/bash - import_role: name: ansible.receptor.setup +{% endverbatim %} +{% if instance.node_type == "execution" %} - import_role: name: ansible.receptor.podman -{% endverbatim %} +{% endif %} diff --git a/awx/api/views/instance_install_bundle.py b/awx/api/views/instance_install_bundle.py index 50eb9f1434..518b43e49e 100644 --- a/awx/api/views/instance_install_bundle.py +++ b/awx/api/views/instance_install_bundle.py @@ -83,7 +83,7 @@ class InstanceInstallBundle(GenericAPIView): tar_addfile(cert_tarinfo, cert) # generate and write install_receptor.yml to the tar file - playbook = generate_playbook().encode('utf-8') + playbook = generate_playbook(instance_obj).encode('utf-8') playbook_tarinfo = tarfile.TarInfo(f"{instance_obj.hostname}_install_bundle/install_receptor.yml") tar_addfile(playbook_tarinfo, playbook) @@ -109,8 +109,10 @@ class InstanceInstallBundle(GenericAPIView): return response -def generate_playbook(): - return render_to_string("instance_install_bundle/install_receptor.yml") +def generate_playbook(instance_obj): + playbook_yaml = render_to_string("instance_install_bundle/install_receptor.yml", context=dict(instance=instance_obj)) + # convert consecutive newlines with a single newline + return re.sub(r'\n+', '\n', playbook_yaml) def generate_requirements_yml():