-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
261aefc
commit 2e081d9
Showing
5 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
famedly_sync_path: /opt/famedly-sync | ||
|
||
famedly_sync_container_image_force_pull: "{{ famedly_sync_container_image_tag is defined }}" | ||
|
||
famedly_sync_version: "0.6.0" | ||
|
||
famedly_sync_container_image_reference: >- | ||
{{ | ||
famedly_sync_container_image_repository | ||
+ ':' | ||
+ famedly_sync_container_image_tag | default('v' + famedly_sync_version) | ||
}} | ||
famedly_sync_container_image_repository: >- | ||
{{ | ||
( | ||
container_registries[famedly_sync_container_image_registry] | ||
| default(famedly_sync_container_image_registry) | ||
) | ||
+ '/' | ||
+ famedly_sync_container_image_namespace | default('') | ||
+ famedly_sync_container_image_name | ||
}} | ||
famedly_sync_container_image_registry: "docker-oss.nexus.famedly.de" | ||
famedly_sync_container_image_name: "famedly-sync-agent" | ||
|
||
famedly_sync_docker_networks: | ||
- name: host | ||
|
||
famedly_sync_docker_volumes: | ||
- "{{ famedly_sync_path }}:/opt/famedly-sync:rw" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- name: Restart famedly-sync.timer | ||
listen: "restart famedly-sync.timer" | ||
become: true | ||
ansible.builtin.systemd: | ||
daemon_reload: true | ||
name: famedly-sync.timer | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
|
||
- name: "Create volume path" | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: "directory" | ||
mode: "0700" | ||
loop: | ||
- "{{ famedly_sync_path }}" | ||
|
||
- name: "Ensure container image is present locally" | ||
community.docker.docker_image: | ||
name: "{{ famedly_sync_container_image_reference }}" | ||
source: "pull" | ||
state: "present" | ||
force_source: "{{ famedly_sync_container_image_force_pull }}" | ||
|
||
- name: "Ensure container is present" | ||
community.docker.docker_container: | ||
name: famedly-sync | ||
image: "{{ famedly_sync_container_image_reference }}" | ||
state: "present" | ||
volumes: "{{ famedly_sync_docker_volumes }}" | ||
labels: "{{ famedly_sync_docker_labels | default(omit, True) }}" | ||
networks: "{{ famedly_sync_docker_networks }}" | ||
|
||
- name: "Deploy config" | ||
ansible.builtin.copy: | ||
content: "{{ famedly_sync_config | to_nice_yaml(indent=2) }}" | ||
dest: "{{ famedly_sync_path }}/config.yaml" | ||
mode: "0400" | ||
|
||
- name: "Install systemd units" | ||
ansible.builtin.template: | ||
src: "{{ item }}.j2" | ||
dest: "/etc/systemd/system/{{ item }}" | ||
owner: root | ||
group: root | ||
mode: "0644" | ||
notify: "restart famedly-sync.timer" | ||
loop: | ||
- famedly-sync.service | ||
- famedly-sync.timer | ||
|
||
- name: "Enable famedly-sync.timer" | ||
ansible.builtin.systemd: | ||
name: famedly-sync.timer | ||
state: started | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Unit] | ||
Description=Sync users from LDAP to Zitadel | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/docker start -a famedly-sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description=Sync users from LDAP to Zitadel regularly | ||
|
||
[Timer] | ||
OnBootSec=15min | ||
OnUnitActiveSec=15min | ||
|
||
[Install] | ||
WantedBy=timers.target |