blob: ed9670f7a673f5200bc79556698adf05354f9e94 [file] [log] [blame]
Zack Williamsa2763112017-01-03 11:38:38 -07001---
2# xos-docker-images/tasks/main.yml
3
4- name: Build xos-base docker image
5 when: build_xos_base_image
6 docker_image:
7 name: "xosproject/xos-base"
8 path: "{{ cord_dir }}/orchestration/xos/containers/xos"
9 dockerfile: "Dockerfile.base"
10
11- name: Pull xos-base docker image from Dockerhub
12 when: not build_xos_base_image
13 docker_image:
14 name: "xosproject/xos-base"
15
16- name: Obtain XOS git repo metadata
17 command: "git log --pretty=format:'{\"XOS_GIT_COMMIT_DATE\":\"%ci\", \"XOS_GIT_COMMIT_HASH\":\"%H\"}' -n 1"
18 args:
19 chdir: "{{ cord_dir }}/orchestration/xos/"
20 register: xos_git_metadata
21 tags:
22 - skip_ansible_lint # idempotent git metadata retrieval, git module can't do this
23
24- name: Copy over SSL CA certificates
25 copy:
26 src: "{{ playbook_dir }}/pki/intermediate_ca/certs/im_cert_chain.pem"
27 dest: "{{ cord_dir }}/orchestration/xos/containers/xos/local_certs.crt"
28 mode: 0644
29
30- name: Build xosproject/xos devel image
31 docker_image:
32 name: "xosproject/xos"
33 path: "{{ cord_dir }}/orchestration/xos/"
34 dockerfile: "containers/xos/Dockerfile.devel"
35 buildargs: "{{ xos_git_metadata.stdout }}"
36 pull: False # should use locally created, or already pulled xos-base image
37
38- name: Build xosproject/xos-test testing image
39 when: build_xos_test_image
40 docker_image:
41 name: "xosproject/xos-test"
42 path: "{{ cord_dir }}/orchestration/xos/"
43 dockerfile: "containers/xos/Dockerfile.test"
44 pull: False # use the locally built copy of xosproject/xos
45
Scott Baker5ca4bd12017-02-10 15:17:06 -080046- name: Clean up chameleon temp directory
47 shell: rm -rf {{ cord_dir }}/orchestration/xos/containers/chameleon/tmp.chameleon
48 tags:
49 - skip_ansible_lint # docker can't access files outside of build context, so we must copy
50
51- name: Populate chameleon temp directory
52 shell: cp -a "{{ cord_dir }}/component/chameleon" "{{ cord_dir }}/orchestration/xos/containers/chameleon/tmp.chameleon"
53 tags:
54 - skip_ansible_lint # docker can't access files outside of build context, so we must copy
55
56- name: Build xosproject/chameleon image
57 docker_image:
58 name: "xosproject/chameleon"
59 path: "{{ cord_dir }}/orchestration/xos/containers/chameleon"
60 dockerfile: "Dockerfile.chameleon"
61 pull: False # use the locally built copy of xosproject/xos
62
Scott Baker970f24b2017-02-13 14:16:40 -080063- name: Build xosproject/xos-rest-gw container image
64 docker_image:
65 name: "xosproject/xos-rest-gw"
66 path: "{{ cord_dir }}/orchestration/xos-rest-gw"
67 dockerfile: "Dockerfile"
68 pull: False # use the locally built copy of xosproject/xos
69
70- name: Build xosproject/xos-gui container image
71 docker_image:
72 name: "xosproject/xos-gui"
73 path: "{{ cord_dir }}/orchestration/xos-gui"
74 dockerfile: "Dockerfile"
75 pull: False # use the locally built copy of xosproject/xos
76
Zack Williamsa2763112017-01-03 11:38:38 -070077- name: Tag and push xos-base image to docker registry
78 when: push_xos_base_image
79 docker_image:
80 name: "{{ deploy_docker_registry }}/xosproject/xos-base"
81 tag: "{{ deploy_docker_tag }}"
82 push: yes
83
84- name: Tag and push xos image to docker registry
85 when: push_xos_image
86 docker_image:
87 name: "{{ deploy_docker_registry }}/xosproject/xos"
88 tag: "{{ deploy_docker_tag }}"
89 push: True
90