# How to define "ANSIBLE\_PYTHON\_INTERPRETER" in docker-compose.yml

**URL:** <https://forum.ansible.com/t/how-to-define-ansible-python-interpreter-in-docker-compose-yml/40152>\
**Category:** Get Help\
**Created:** [February 10, 2025, 2:31pm UTC](https://forum.ansible.com/t/how-to-define-ansible-python-interpreter-in-docker-compose-yml/40152 "2025-02-10T14:31:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aristosv](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@aristosv](https://forum.ansible.com/u/aristosv)\
**Post date:** [February 10, 2025, 2:31pm UTC](https://forum.ansible.com/t/how-to-define-ansible-python-interpreter-in-docker-compose-yml/40152/1 "2025-02-10T14:31:15Z")

</div>

I’m having second thoughts asking this question here, since it might be a semaphore question, not ansible, but semaphore is a great way of getting started with ansible so I’m taking my chances.

This is how I installed semaphore with ansible.

```auto
services:
  mariadb:
    image: linuxserver/mariadb
    container_name: mariadb
    hostname: mariadb
    restart: unless-stopped
    environment:
      - PUID=1001
      - PGID=1001
      - MYSQL_USER=semaphore
      - MYSQL_PASSWORD=semaphore
      - MYSQL_DATABASE=semaphore
      - MYSQL_ROOT_PASSWORD=root_pass_here
    ports:
      - 3306:3306
    volumes:
      - mariadb:/config

  semaphore:
    image: semaphoreui/semaphore
    container_name: semaphore
    hostname: semaphore
    restart: unless-stopped
    environment:
      - PUID=1001
      - PGID=1001

      - SEMAPHORE_DB=semaphore
      - SEMAPHORE_DB_USER=semaphore
      - SEMAPHORE_DB_PASS=semaphore

      - SEMAPHORE_DB_PORT=3306
      - SEMAPHORE_DB_HOST=mariadb
      - SEMAPHORE_DB_DIALECT=mysql
      - SEMAPHORE_PLAYBOOK_PATH=/tmp/semaphore/

      - SEMAPHORE_ADMIN=admin
      - SEMAPHORE_ADMIN_NAME=admin
      - SEMAPHORE_ADMIN_PASSWORD=admin
      - SEMAPHORE_ADMIN_EMAIL=admin@localhost
      - SEMAPHORE_ACCESS_KEY_ENCRYPTION=key_here

      - ANSIBLE_HOST_KEY_CHECKING=false
      - ANSIBLE_PYTHON_INTERPRETER=auto_silent
    ports:
      - 3000:3000
    volumes:
      - semaphore:/etc/ansible
      - semaphore:/etc/semaphore
      - semaphore:/tmp/semaphore
      - semaphore:/var/lib/semaphore

volumes:
  mariadb:
  semaphore:

```

If I check `ansible.cfg` the variable `ANSIBLE_HOST_KEY_CHECKING=false` appears to be there.

```auto
[defaults]
host_key_checking = False
bin_ansible_callbacks = True
stdout_callback = yaml

```

But the variable `ANSIBLE_PYTHON_INTERPRETER=auto_silent` seems to be ignored. It doesn’t exist in `ansible.cfg`

As a result, all my tasks produce the same warning.

 ![semaphore](https://us1.discourse-cdn.com/ansible/original/2X/1/1cc557bfb563896b6d78bb73e60d7ebe19260fb4.png)

I know I can define this manually in ansible.cfg, but I would really prefer to do it in docker-compose.yml

---

<div class="post-metadata">

**Author:** ![bcoca](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bcoca/32/9269_2.png) [@bcoca](https://forum.ansible.com/u/bcoca)\
**Post date:** [February 10, 2025, 6:09pm UTC](https://forum.ansible.com/t/how-to-define-ansible-python-interpreter-in-docker-compose-yml/40152/2 "2025-02-10T18:09:26Z")

</div>

Creating the environment variable should not update ansible.cfg, it overrides it. In any case the issue here is that you are assuming semaphore passes it’s full environment to ansible CLI
