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