roles/containers: got gitea container up
This commit is contained in:
parent
9b4e047171
commit
dd0de3139e
@ -3,4 +3,4 @@
|
||||
# these are defaults
|
||||
# change these in group/host vars
|
||||
|
||||
docker_compose_dir: "/opts/services"
|
||||
docker_compose_dir: "/opt/services"
|
||||
|
@ -6,6 +6,11 @@
|
||||
- docker
|
||||
- docker-compose
|
||||
|
||||
- name: Create docker user
|
||||
user:
|
||||
name: docker
|
||||
group: docker
|
||||
|
||||
- name: Create docker-compose directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ docker_compose_dir }}"
|
||||
@ -17,6 +22,7 @@
|
||||
template:
|
||||
src: "docker-compose.yml.j2"
|
||||
dest: "{{ docker_compose_dir }}/docker-compose.yml"
|
||||
register: docker-comp
|
||||
|
||||
- name: Create systemd unit file
|
||||
template:
|
||||
@ -26,5 +32,12 @@
|
||||
- name: Compose up
|
||||
systemd:
|
||||
name: docker-compose
|
||||
state: started
|
||||
state: "{{ 'restarted' if docker-comp.changed else 'started' }}"
|
||||
enabled: true
|
||||
|
||||
# for some reason port mappings don't work without this?
|
||||
- name: Restart docker for good measure
|
||||
systemd:
|
||||
name: docker
|
||||
state: restarted
|
||||
when: docker-comp.changed
|
||||
|
@ -4,6 +4,8 @@ Requires=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
User=docker
|
||||
Group=docker
|
||||
WorkingDirectory={{ docker_compose_dir }}
|
||||
ExecStartPre=-/usr/bin/docker compose pull
|
||||
ExecStart=/usr/bin/docker compose up --remove-orphans
|
||||
|
@ -23,6 +23,6 @@ services:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "222:22"
|
||||
- "2499:22"
|
||||
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user