17 lines
598 B
YAML
17 lines
598 B
YAML
---
|
|
- name: "Check if Python is installed"
|
|
delegate_to: "{{ hostvars[inventory_hostname].lxd_host }}"
|
|
shell: >-
|
|
lxc exec {{ inventory_hostname }} --
|
|
dpkg -s {{ hostvars[inventory_hostname].python_package }}
|
|
register: python_install_check
|
|
failed_when: python_install_check.rc not in [0, 1]
|
|
changed_when: False
|
|
|
|
- name: "Install Python in container"
|
|
delegate_to: "{{ hostvars[inventory_hostname].lxd_host }}"
|
|
shell: >-
|
|
lxc exec {{ inventory_hostname }} --
|
|
apt-get install -y {{ hostvars[inventory_hostname].python_package }}
|
|
when: python_install_check.rc == 1
|