ansible-collection-woodpecker/roles/woodpecker/tasks/main.yml

88 lines
2.7 KiB
YAML
Raw Normal View History

---
- name: 'Install required software'
become: true
ansible.builtin.apt:
name: 'podman'
state: 'present'
- name: 'Prepare network'
become: true
containers.podman.podman_network:
name: '{{ woodpecker_podman_network }}'
state: 'quadlet'
notify:
- 'Reload woodpecker services'
- 'Restart woodpecker network'
- name: 'Create woodpecker volumes'
become: true
containers.podman.podman_volume:
name: '{{ item }}'
state: 'quadlet'
loop:
- '{{ woodpecker_server_data_volume }}'
- '{{ woodpecker_agent_config_volume }}'
notify:
- 'Reload woodpecker services'
- 'Restart woodpecker volumes'
- name: 'Define woodpecker images'
become: true
containers.podman.podman_image:
name: '{{ item.image }}'
quadlet_filename: '{{ item.quadlet_name }}'
state: 'quadlet'
loop:
- image: '{{ woodpecker_server_image_name }}:{{ woodpecker_server_image_tag }}'
quadlet_name: 'woodpecker-server'
- image: '{{ woodpecker_agent_image_name }}:{{ woodpecker_agent_image_tag }}'
quadlet_name: 'woodpecker-agent'
notify:
- 'Reload woodpecker services'
- 'Restart woodpecker images'
- name: 'Create woodpecker-server container'
become: true
containers.podman.podman_container:
name: '{{ woodpecker_server_container_name }}'
image: 'woodpecker-server.image'
network: '{{ woodpecker_podman_network }}.network'
state: 'quadlet'
volume:
- '{{ woodpecker_server_data_volume }}.volume:/var/lib/woodpecker'
env: '{{ woodpecker_server_environments }}'
quadlet_options: |
[Install]
WantedBy=default.target
[Unit]
Requires={{ woodpecker_podman_network }}-network.service
Requires={{ woodpecker_server_data_volume }}-volume.service
After={{ woodpecker_podman_network }}-network.service
After={{ woodpecker_server_data_volume }}-volume.service
notify:
- 'Reload woodpecker services'
- 'Restart woodpecker-server'
- name: 'Create woodpecker-agent container'
become: true
containers.podman.podman_container:
name: 'woodpecker-agent'
image: 'woodpecker-agent.image'
network: '{{ woodpecker_podman_network }}.network'
state: 'quadlet'
volume:
- '{{ woodpecker_agent_config_volume }}.volume:/etc/woodpecker'
- '/var/run/podman/podman.sock:/var/run/docker.sock'
env: '{{ woodpecker_agent_environments }}'
quadlet_options: |
[Install]
WantedBy=default.target
[Unit]
Requires={{ woodpecker_podman_network }}-network.service
Requires={{ woodpecker_server_data_volume }}-volume.service
After={{ woodpecker_podman_network }}-network.service
After={{ woodpecker_server_data_volume }}-volume.service
notify:
- 'Reload woodpecker services'
- 'Restart woodpecker-agent'