notageek27
notageek27

Reputation: 101

Install any application in an ubuntu pod running in Azure Kubernetes using Ansible AWX playbook

I am trying to install python3 in an ubuntu container running on AKS using an Ansible Playbook. Here are the steps I am following in the playbook.

  1. Create a pod with ubuntu latest image ( deployment file using the k8s module ).
  2. Adding pod name to hosts.
  3. Install python3 on the ubuntu container using the below snippet.

enter image description here

I am getting this error in the console of AWX job:

enter image description here

Any idea how I can correct this ? Is there another way to directly install python3 using the deployment file of ubuntu pod ?

Upvotes: 0

Views: 433

Answers (1)

Zeitounator
Zeitounator

Reputation: 44615

Preliminary notes:

  • Please edit your question and switch your images to code blocks. I explained why in my above comment.
  • I'm answering your precise question here. But unless you are in a specific use case (testing a playbook/role/collection, specific development environment....), deploying software with ansible (or actually anything else) inside a running container after its deployment is globally a bad idea. Build an image containing all the tooling you need and deploy it directly.

Now to your problem. All ansible modules with the only exceptions of raw and script require python to be installed on the target machine. It looks like this requirement is not met.

Hence you need to use the raw module which is specifically made for that (and that you should use only for that as a good practice)

---
- name: install ansible requirements with the low down dirty raw module
  raw: apt-get update && apt-get -y --no-install-recommends install python3

But once again, even in a test use case, you should build and deploy an image already containing the requirements for ansible (i.e. already having python). You can easily use any official python image from dockerhub for that as a simple example.

Upvotes: 1

Related Questions