File: provision.yml

package info (click to toggle)
check-pgbackrest 2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,396 kB
  • sloc: perl: 972; sh: 488; python: 145; makefile: 33
file content (74 lines) | stat: -rw-r--r-- 1,804 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
- assert:
    msg: "Unsupported docker image_name: '{{ docker.image_name }}'"
    that: docker.image_name in _available_images
  vars:
    _available_images:
      - 'debian:11'
      - 'ubuntu:22.04'
      - 'rockylinux:8'
      - 'rockylinux:9'

- name: Build systemd image {{ docker.image_name }}
  docker_image:
    name: "systemd/{{ _image_base }}:{{ _image_tag }}"
    state: present
    source: build
    build:
      path: docker/systemd
      dockerfile: "{{ _image_base }}.Dockerfile"
      pull: no
      args:
        BASE_IMAGE: "{{ _image_base }}:{{ _image_tag }}"
  vars:
    _parts: "{{ docker.image_name.split(':') }}"
    _image_base: "{{ _parts[0] }}"
    _image_tag: "{{ _parts[1] }}"

- name: Create docker network
  docker_network:
    name: "network_{{ cluster_name }}"
    state: present

- name: Ensure that the cluster's default shared directory exist
  file:
    path: "{{ cluster_dir }}/shared"
    state: directory
    owner: root
    group: root
    mode: '1777'
  become: yes

- name: Provision docker containers
  include_tasks: docker_container.yml
  loop: "{{ instances | flatten(levels=1) }}"
  loop_control:
    label: >-
      {{ item.name }}

- name: Set instance variables
  set_fact:
    instance_vars: "{{
      instance_vars | default([]) | union([
        { 
          'name': item.item.name,
          'vars': item.item
        }
      ]) 
    }}"
  with_items:
    "{{ docker_container_results }}"
  loop_control:
    label: >-
      {{ item.item.name }}

- name: Create private ip list
  set_fact:
    private_ip_list: "{{
      private_ip_list | default({}) | combine({ item.name: item.vars.private_ip })
    }}"
  when: item.vars.private_ip is defined
  loop: "{{ instance_vars|flatten(levels=1) }}"
  loop_control:
    label: >-
      {{ item.name }}