aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/docker_images/tasks
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-04-28 11:27:25 +0000
committerpmikus <peter.mikus@protonmail.ch>2023-04-28 11:27:25 +0000
commitd14b7a69e628582b9132abc1b6e09aada68c0077 (patch)
tree4ac651bd5240093f82580656bf5a95639c976fa3 /fdio.infra.ansible/roles/docker_images/tasks
parentf451c7a50bc663a6727f01873b8663bfa9ae22e1 (diff)
feat(ansible): Refactor docker-image roles
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: I6731e55b9643f46463c16f68e4986e3cb61f843f
Diffstat (limited to 'fdio.infra.ansible/roles/docker_images/tasks')
-rw-r--r--fdio.infra.ansible/roles/docker_images/tasks/base.yaml63
-rw-r--r--fdio.infra.ansible/roles/docker_images/tasks/main.yaml21
-rw-r--r--fdio.infra.ansible/roles/docker_images/tasks/sut.yaml28
-rw-r--r--fdio.infra.ansible/roles/docker_images/tasks/tg.yaml28
4 files changed, 140 insertions, 0 deletions
diff --git a/fdio.infra.ansible/roles/docker_images/tasks/base.yaml b/fdio.infra.ansible/roles/docker_images/tasks/base.yaml
new file mode 100644
index 0000000000..69b3f6217d
--- /dev/null
+++ b/fdio.infra.ansible/roles/docker_images/tasks/base.yaml
@@ -0,0 +1,63 @@
+---
+# file: tasks/base.yaml
+
+- name: "Create a Directory For Docker Images"
+ ansible.builtin.file:
+ path: "/opt/csit-docker-images/"
+ state: "directory"
+ mode: 0755
+ tags:
+ - docker-base
+
+- name: "Copy Build Items"
+ ansible.builtin.copy:
+ src: "{{ item }}"
+ dest: "/opt/csit-docker-images/{{ item }}"
+ owner: "root"
+ group: "root"
+ mode: 0755
+ with_items:
+ - "base/"
+ - "csit-sut/"
+ tags:
+ - docker-base
+
+- name: "Build CSIT Base Docker Image"
+ ansible.builtin.shell: "docker build -t base-ubuntu2204:local ."
+ args:
+ chdir: "/opt/csit-docker-images/base"
+ async: 3000
+ poll: 0
+ register: "docker_built"
+ tags:
+ - docker-base
+
+- name: "Check if CSIT Base Docker Image is Built"
+ async_status:
+ jid: "{{ docker_built.ansible_job_id }}"
+ register: "docker_built"
+ until: "docker_built.finished"
+ delay: 10
+ retries: 300
+ tags:
+ - docker-base
+
+- name: "Build CSIT OLD Docker Image"
+ ansible.builtin.shell: "docker build -t csit_sut-ubuntu2204:local ."
+ args:
+ chdir: "/opt/csit-docker-images/csit-sut"
+ async: 3000
+ poll: 0
+ register: "docker_built"
+ tags:
+ - docker-base
+
+- name: "Check if CSIT OLD Docker Image is Built"
+ async_status:
+ jid: "{{ docker_built.ansible_job_id }}"
+ register: "docker_built"
+ until: "docker_built.finished"
+ delay: 10
+ retries: 300
+ tags:
+ - docker-base \ No newline at end of file
diff --git a/fdio.infra.ansible/roles/docker_images/tasks/main.yaml b/fdio.infra.ansible/roles/docker_images/tasks/main.yaml
new file mode 100644
index 0000000000..1005e024f2
--- /dev/null
+++ b/fdio.infra.ansible/roles/docker_images/tasks/main.yaml
@@ -0,0 +1,21 @@
+---
+# file: tasks/main.yaml
+
+- name: "Build Base Docker Images"
+ import_tasks: "base.yaml"
+ tags:
+ - docker-base
+
+- name: "Docker Orchestration for TG"
+ import_tasks: "tg.yaml"
+ when: >
+ docker_tg is defined
+ tags:
+ - docker-tg
+
+- name: "Docker Orchestration for SUT"
+ import_tasks: "sut.yaml"
+ when: >
+ docker_sut is defined
+ tags:
+ - docker-sut \ No newline at end of file
diff --git a/fdio.infra.ansible/roles/docker_images/tasks/sut.yaml b/fdio.infra.ansible/roles/docker_images/tasks/sut.yaml
new file mode 100644
index 0000000000..8ac179573d
--- /dev/null
+++ b/fdio.infra.ansible/roles/docker_images/tasks/sut.yaml
@@ -0,0 +1,28 @@
+---
+# file: tasks/sut.yaml
+
+- name: "Template Compose File"
+ ansible.builtin.template:
+ src: "{{ item }}.j2"
+ dest: "/opt/csit-docker-images/{{ item }}"
+ owner: "root"
+ group: "root"
+ mode: 0755
+ with_items:
+ - "docker-compose-sut.yaml"
+ tags:
+ - docker-sut
+
+- name: "Copy csit-initialize-docker-sut.service"
+ ansible.builtin.copy:
+ src: "files/csit-initialize-docker-sut.service"
+ dest: "/etc/systemd/system/"
+ owner: "root"
+ group: "root"
+ mode: 0644
+ notify:
+ - "Start csit-initialize-docker-sut.service"
+ tags:
+ - docker-sut
+
+- meta: flush_handlers \ No newline at end of file
diff --git a/fdio.infra.ansible/roles/docker_images/tasks/tg.yaml b/fdio.infra.ansible/roles/docker_images/tasks/tg.yaml
new file mode 100644
index 0000000000..0623616073
--- /dev/null
+++ b/fdio.infra.ansible/roles/docker_images/tasks/tg.yaml
@@ -0,0 +1,28 @@
+---
+# file: tasks/tg.yaml
+
+- name: "Template Compose File"
+ ansible.builtin.template:
+ src: "{{ item }}.j2"
+ dest: "/opt/csit-docker-images/{{ item }}"
+ owner: "root"
+ group: "root"
+ mode: 0755
+ with_items:
+ - "docker-compose-tg.yaml"
+ tags:
+ - docker-tg
+
+- name: "Start csit-initialize-docker-tg.service"
+ ansible.builtin.copy:
+ src: "files/csit-initialize-docker-tg.service"
+ dest: "/etc/systemd/system/"
+ owner: "root"
+ group: "root"
+ mode: 0644
+ notify:
+ - "Start csit-initialize-docker-tg.service"
+ tags:
+ - docker-tg
+
+- meta: flush_handlers \ No newline at end of file