scrypted/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 29 Jul 2024 12:41:57 -0500
changeset 237 c6c11084c802
parent 235 f88bb54f63bd
permissions -rw-r--r--
Cleaned up always-changed status tasks.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
235
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: add scrypted user
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  user: name="scrypted" shell="/bin/false" system="yes" create_home="no" groups="docker"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
- name: install docker apt packages
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
  become: yes
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  apt: name="docker-ce"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
- name: make scrypted dir
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
  become: yes
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
  file:
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
    path: "{{item}}"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
    state: "directory"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
    owner: "scrypted"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
    group: "scrypted"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
    mode: "0755"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
  loop:
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
    - "{{scrypted_dir}}"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
    - "{{scrypted_dir}}/volume"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
- name: configure scrypted docker compose
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
  become: yes
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
  template:
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
    src: "docker-compose.yml.j2"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
    dest: "{{scrypted_dir}}/docker-compose.yml"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
    owner: "scrypted"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
    group: "scrypted"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
    mode: "0600"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
- name: docker compose pull
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
  become: yes
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
  become_user: "scrypted"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
  command: "docker compose pull"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
  args:
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
    chdir: "{{scrypted_dir}}"
237
c6c11084c802 Cleaned up always-changed status tasks.
Luke Hoersten <luke@hoersten.org>
parents: 235
diff changeset
    38
  changed_when: false
235
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
- name: docker compose
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
  become: yes
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
  become_user: "scrypted"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
  command: "docker compose up -d"
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
  args:
f88bb54f63bd Added scrypted role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
    chdir: "{{scrypted_dir}}"
237
c6c11084c802 Cleaned up always-changed status tasks.
Luke Hoersten <luke@hoersten.org>
parents: 235
diff changeset
    46
  changed_when: false