blob: 85af01c7c3bf462aab91a8da981ad8578144db26 [file] [log] [blame]
Zack Williamsa2763112017-01-03 11:38:38 -07001---
2# cord-profile/tasks/main.yml
3# Constructs a CORD service profile directory and configuration files
4
Andy Baviera6cffe12017-03-15 17:33:42 -04005- name: Create and copy XOS admin password
6 copy:
7 content: "{{ xos_admin_pass }}"
8 dest: "{{ cord_dir }}/build/platform-install/credentials/{{ xos_admin_user }}"
9
Zack Williamsa2763112017-01-03 11:38:38 -070010- name: Create cord_profile directory
11 become: yes
12 file:
13 path: "{{ cord_profile_dir }}"
14 state: directory
15 mode: 0755
16 owner: "{{ ansible_user_id }}"
17 group: "{{ ansible_user_gid }}"
18
Zack Williams2478b302017-02-14 10:42:55 -070019- name: Create cord_profile/profile_name with the name of the profile
20 copy:
21 dest: "{{ cord_profile_dir }}/profile_name"
22 content: "{{ cord_profile }}"
23 mode: 0644
24
Zack Williamsa2763112017-01-03 11:38:38 -070025- name: Create subdirectories inside cord_profile directory
26 file:
27 path: "{{ cord_profile_dir }}/{{ item }}"
28 state: directory
29 mode: 0755
30 with_items:
31 - key_import
32 - onboarding-docker-compose
33 - images
34
Andy Bavier1ff4b482017-03-24 09:20:36 -040035# *** This should be revisited. ***
36# Currently the key pair is generated on the head node by the
37# "prep" role in the "maas" repo, invoked during the "deployBase" Gradle task.
38# The keys should probably be generated earlier, in the corddev VM, and copied over.
39# The /opt/credentials directory might be a good place to keep the generated keys.
40#
41# Ensure a keypair exists in case we're not running on MaaS.
42- name: Ensure keypair
43 user:
44 name: "{{ ansible_user_id }}"
45 generate_ssh_key: yes
46
Zack Williamsa2763112017-01-03 11:38:38 -070047- name: Copy ssh keys to key_import directory
48 copy:
Zack Williamsa2763112017-01-03 11:38:38 -070049 src: "{{ item.source_path | expanduser }}"
50 dest: "{{ cord_profile_dir }}/key_import/{{ item.name }}"
51 mode: 0600
Andy Bavier1ff4b482017-03-24 09:20:36 -040052 remote_src: True
Zack Williamsa2763112017-01-03 11:38:38 -070053 with_items: "{{ xos_service_sshkeys }}"
54
Andy Baviera6cffe12017-03-15 17:33:42 -040055- name: Copy cert chain and core api key and cert
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040056 copy:
57 src: "{{ pki_dir }}/{{ item }}"
58 dest: "{{ cord_profile_dir }}/{{ item }}"
59 mode: 0600
Andy Baviera6cffe12017-03-15 17:33:42 -040060 remote_src: True
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040061 with_items:
62 - core_api_key.pem
63 - core_api_cert.pem
Andy Baviera6cffe12017-03-15 17:33:42 -040064 - im_cert_chain.pem
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040065
Andy Baviera6cffe12017-03-15 17:33:42 -040066- name: Make local images directory
67 delegate_to: localhost
Zack Williamsc6ff6b32017-02-10 16:35:29 -070068 become: yes
69 file:
Andy Baviera6cffe12017-03-15 17:33:42 -040070 path: "{{ image_dir }}"
Zack Williamsc6ff6b32017-02-10 16:35:29 -070071 state: directory
72 mode: 0755
73 owner: "{{ ansible_user_id }}"
74 group: "{{ ansible_user_gid }}"
75
Zack Williamsa2763112017-01-03 11:38:38 -070076- name: Download Glance VM images
Andy Baviera6cffe12017-03-15 17:33:42 -040077 when: use_openstack
78 delegate_to: localhost
Zack Williamsa2763112017-01-03 11:38:38 -070079 get_url:
80 url: "{{ item.url }}"
81 checksum: "{{ item.checksum }}"
Andy Baviera6cffe12017-03-15 17:33:42 -040082 dest: "{{ image_dir }}/{{ item.name }}.qcow2"
Zack Williamsc6ff6b32017-02-10 16:35:29 -070083 with_items: "{{ xos_images }}"
84
85- name: Copy Glance VM images to profile directory
Andy Baviera6cffe12017-03-15 17:33:42 -040086 when: use_openstack
Zack Williamsc6ff6b32017-02-10 16:35:29 -070087 copy:
Andy Baviera6cffe12017-03-15 17:33:42 -040088 src: "{{ image_dir }}/{{ item.name }}.qcow2"
Zack Williamsa2763112017-01-03 11:38:38 -070089 dest: "{{ cord_profile_dir }}/images/{{ item.name }}.qcow2"
90 with_items: "{{ xos_images }}"
91
92- name: Copy over commonly used and utility TOSCA files
93 copy:
94 src: "{{ item }}"
95 dest: "{{ cord_profile_dir }}/{{ item }}"
96 with_items:
97 - fixtures.yaml
98 - enable-onboarding.yaml
99 - disable-onboarding.yaml
100
101- name: Create templated XOS configuration files
102 template:
103 src: "{{ item }}.j2"
104 dest: "{{ cord_profile_dir }}/{{ item }}"
105 mode: 0644
106 with_items:
107 - xos_common_config
108 - deployment.yaml
109 - xos.yaml
110 - xos-bootstrap-docker-compose.yaml
Scott Baker5ca4bd12017-02-10 15:17:06 -0800111 - onboard-chameleon.yaml
Matteo Scandolo6050fda2017-02-16 13:01:52 -0800112 - onboard-gui-extensions-store.yaml
Scott Baker970f24b2017-02-13 14:16:40 -0800113 - onboard-xos-gui.yaml
114 - onboard-xos-rest-gw.yaml
115 - gateway-config.yml
Matteo Scandolo667334f2017-02-26 10:58:08 -0800116 - style.config.js
117 - app.config.js
Andy Baviera6cffe12017-03-15 17:33:42 -0400118 - Dockerfile.xos
119 - xos-gui-extensions-onboard.yml
120 - xos-gui-extensions.yml
Zack Williamsa2763112017-01-03 11:38:38 -0700121
122- name: Create profile specific templated TOSCA config files
123 template:
124 src: "{{ item }}.j2"
125 dest: "{{ cord_profile_dir }}/{{ item }}"
126 with_items: "{{ xos_tosca_config_templates }}"
127
128- name: Create profile specific templated non-TOSCA files
129 template:
130 src: "{{ item }}.j2"
131 dest: "{{ cord_profile_dir }}/{{ item }}"
132 with_items: "{{ xos_other_templates }}"
133
Andy Baviera6cffe12017-03-15 17:33:42 -0400134- name: Copy node key
135 when: not on_maas and use_openstack
Zack Williamsa2763112017-01-03 11:38:38 -0700136 copy:
Andy Baviera6cffe12017-03-15 17:33:42 -0400137 src: "{{ ansible_user_dir }}/.ssh/id_rsa"
138 dest: "{{ item }}/node_key"
139 owner: "{{ ansible_user }}"
Zack Williams2a5f6862017-02-09 16:39:52 -0700140 mode: 0600
Andy Bavier1ff4b482017-03-24 09:20:36 -0400141 remote_src: True
Andy Baviera6cffe12017-03-15 17:33:42 -0400142 with_items:
143 - "{{ ansible_user_dir }}"
144 - "{{ cord_profile_dir }}"
145
146- name: Copy node key (MaaS)
147 when: on_maas and use_openstack
148 become: yes
149 copy:
150 src: "{{ maas_node_key }}"
151 dest: "{{ item }}/node_key"
152 owner: "{{ ansible_user }}"
153 mode: 0600
154 remote_src: True
155 with_items:
156 - "{{ ansible_user_dir }}"
157 - "{{ cord_profile_dir }}"