blob: 37c1a6ab319a994862334cfe1947425a9c50e744 [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
Zack Williamsa2763112017-01-03 11:38:38 -070063- name: Tag and push xos-base image to docker registry
64 when: push_xos_base_image
65 docker_image:
66 name: "{{ deploy_docker_registry }}/xosproject/xos-base"
67 tag: "{{ deploy_docker_tag }}"
68 push: yes
69
70- name: Tag and push xos image to docker registry
71 when: push_xos_image
72 docker_image:
73 name: "{{ deploy_docker_registry }}/xosproject/xos"
74 tag: "{{ deploy_docker_tag }}"
75 push: True
76