ansible-woodpecker-role/tasks/main.yml

73 lines
2.0 KiB
YAML
Raw Normal View History

2021-12-19 23:44:51 +01:00
---
- name: Create rootdir
ansible.builtin.file:
path: "{{ woodpecker_rootdir }}"
state: directory
owner: root
group: root
mode: 0755
- name: Template server.env-file
ansible.builtin.template:
src: server.env.j2
dest: "{{ woodpecker_rootdir }}/server.env"
owner: root
group: root
mode: 0644
2022-01-14 14:05:18 +01:00
trim_blocks: false
2021-12-19 23:44:51 +01:00
- name: Create the woodpecker network
community.docker.docker_network:
name: woodpecker-net
- name: Create and start the woodpecker-server container
community.docker.docker_container:
name: woodpecker-server
restart_policy: always
pull: true
cap_drop: all
networks:
- name: woodpecker-net
published_ports:
2022-01-14 14:05:56 +01:00
- 8000:8000
2021-12-19 23:44:51 +01:00
volumes:
- "{{ woodpecker_rootdir }}/data:/var/lib/woodpecker"
env_file: "{{ woodpecker_rootdir }}/server.env"
image: "woodpeckerci/woodpecker-server:{{ woodpecker_version }}"
- name: Create and start the woodpecker-agent container
community.docker.docker_container:
name: woodpecker-agent
restart_policy: always
pull: true
2021-12-20 00:20:18 +01:00
userns_mode: host
privileged: true
2021-12-19 23:44:51 +01:00
networks:
- name: woodpecker-net
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
env:
WOODPECKER_SERVER: woodpecker-server:9000
WOODPECKER_AGENT_SECRET: "{{ woodpecker_agent_secret }}"
WOODPECKER_MAX_PROCS: "{{ woodpecker_agent_max_procs }}"
image: "woodpeckerci/woodpecker-agent:{{ woodpecker_version }}"
- name: Create and start the watchtower container if wanted
docker_container:
name: watchtower
restart_policy: always
pull: true
networks:
- name: woodpecker-net
userns_mode: host
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
env:
WATCHTOWER_CLEANUP: "true"
WATCHTOWER_SCHEDULE: "{{ woodpecker_watchtower_schedule }}"
WATCHTOWER_NO_STARTUP_MESSAGE: "true"
TZ: Europe/Berlin
image: containrrr/watchtower:latest
when: woodpecker_watchtower | bool