61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
---
|
|
- name: Install Podman Compose on all Nomad cluster nodes
|
|
hosts: nomad_cluster
|
|
become: yes
|
|
|
|
tasks:
|
|
- name: Display target node
|
|
debug:
|
|
msg: "正在安装 Podman Compose 到节点: {{ inventory_hostname }}"
|
|
|
|
- name: Update package cache
|
|
apt:
|
|
update_cache: yes
|
|
ignore_errors: yes
|
|
|
|
- name: Install Podman and related tools
|
|
apt:
|
|
name:
|
|
- podman
|
|
- podman-compose
|
|
- buildah
|
|
- skopeo
|
|
state: present
|
|
ignore_errors: yes
|
|
|
|
- name: Install additional dependencies
|
|
apt:
|
|
name:
|
|
- python3-pip
|
|
- python3-setuptools
|
|
state: present
|
|
ignore_errors: yes
|
|
|
|
- name: Install podman-compose via pip if package manager failed
|
|
pip:
|
|
name: podman-compose
|
|
state: present
|
|
ignore_errors: yes
|
|
|
|
- name: Verify Podman installation
|
|
shell: podman --version
|
|
register: podman_version
|
|
|
|
- name: Verify Podman Compose installation
|
|
shell: podman-compose --version
|
|
register: podman_compose_version
|
|
ignore_errors: yes
|
|
|
|
- name: Display installation results
|
|
debug:
|
|
msg: |
|
|
✅ 节点 {{ inventory_hostname }} 安装结果:
|
|
📦 Podman: {{ podman_version.stdout }}
|
|
🐳 Podman Compose: {{ podman_compose_version.stdout if podman_compose_version.rc == 0 else '安装失败或不可用' }}
|
|
|
|
- name: Ensure Podman socket is enabled
|
|
systemd:
|
|
name: podman.socket
|
|
enabled: yes
|
|
state: started
|
|
ignore_errors: yes |