ansible-collection-famedly-.../roles/barad-dur/tasks/main.yml
Lars Kaiser abcc898254
chore(barad-dur): general maintenance
- added tags
- fixed file modes
- seperate container pulling and starting
2023-04-20 12:06:47 +02:00

54 lines
1.7 KiB
YAML

---
- name: Create barad-dur system user
user:
name: "{{ barad_dur_user }}"
state: present
system: true
register: barad_dur_user_res
tags: [ 'prepare', 'prepare-barad_dur',
'deploy', 'deploy-barad_dur' ]
- name: Create base-directory for barad-dur [{{ barad_dur_base_path }}]
file:
path: "{{ barad_dur_base_path }}"
state: directory
owner: "{{ barad_dur_user_res.uid }}"
group: "{{ barad_dur_user_res.group }}"
mode: "0755"
tags: [ 'prepare', 'prepare-barad_dur' ]
- name: Template configuration file for barad-dur [{{ barad_dur_config_file }}]
template:
src: config.yaml.j2
dest: "{{ barad_dur_config_file }}"
owner: "{{ barad_dur_user_res.uid }}"
group: "{{ barad_dur_user_res.group }}"
mode: "0640"
notify: restart-barad-dur
tags: [ 'deploy', 'deploy-barad_dur' ]
- name: Pull barad-dur container
docker_image:
name: "{{ barad_dur_container_image_reference }}"
source: pull
state: present
force_source: "{{ barad_dur_container_force_pull }}"
register: barad_dur_container_image_pulled
until: barad_dur_container_image_pulled is success
retries: 10
delay: 5
tags: [ 'prepare', 'prepare-barad_dur' ]
- name: Start barad-dur container
docker_container:
name: "{{ barad_dur_container_name }}"
image: "{{ barad_dur_container_image_reference }}"
env: "{{ barad_dur_container_env }}"
user: "{{ barad_dur_user_res.uid }}:{{ barad_dur_user_res.group }}"
ports: "{{ barad_dur_container_ports }}"
labels: "{{ barad_dur_container_labels_complete }}"
volumes: "{{ barad_dur_container_volumes }}"
restart_policy: "{{ barad_dur_container_restart_policy }}"
state: "{{ barad_dur_container_state }}"
tags: [ 'deploy', 'deploy-barad_dur' ]