blob: 6c4910817a4e1ea515f45cdc0e26a40a539f3861 [file] [log] [blame]
Matteo Scandolo3896c472017-08-01 13:31:42 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Zack Williamsa2763112017-01-03 11:38:38 -070017---
18# cord-profile/tasks/main.yml
19# Constructs a CORD service profile directory and configuration files
20
Zack Williams79286962017-07-10 12:24:37 -070021# if this step fails, may need to include `create-configdirs-become` role to
22# create directory using become.
Zack Williamsa2763112017-01-03 11:38:38 -070023- name: Create cord_profile directory
Zack Williamsa2763112017-01-03 11:38:38 -070024 file:
Zack Williamsc989f262017-05-11 13:02:59 -070025 path: "{{ config_cord_profile_dir }}"
Zack Williamsa2763112017-01-03 11:38:38 -070026 state: directory
27 mode: 0755
28 owner: "{{ ansible_user_id }}"
29 group: "{{ ansible_user_gid }}"
30
Zack Williamsc989f262017-05-11 13:02:59 -070031- name: Create cord_profile/profile_name file containing profile name
Zack Williams2478b302017-02-14 10:42:55 -070032 copy:
Zack Williamsc989f262017-05-11 13:02:59 -070033 dest: "{{ config_cord_profile_dir }}/profile_name"
Zack Williams2478b302017-02-14 10:42:55 -070034 content: "{{ cord_profile }}"
35 mode: 0644
36
Zack Williamsa2763112017-01-03 11:38:38 -070037- name: Create subdirectories inside cord_profile directory
38 file:
Zack Williamsc989f262017-05-11 13:02:59 -070039 path: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -070040 state: directory
41 mode: 0755
42 with_items:
43 - key_import
Zack Williamsa2763112017-01-03 11:38:38 -070044 - images
45
Zack Williamsc989f262017-05-11 13:02:59 -070046- name: Copy ssh private key to node_key file
Zack Williamsa2763112017-01-03 11:38:38 -070047 copy:
Zack Williamsc989f262017-05-11 13:02:59 -070048 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey"
49 dest: "{{ config_cord_profile_dir }}/node_key"
Zack Williamsa2763112017-01-03 11:38:38 -070050 mode: 0600
Andy Bavier1ff4b482017-03-24 09:20:36 -040051 remote_src: True
Zack Williamsc989f262017-05-11 13:02:59 -070052
Zack Williams5223dd92017-02-28 23:38:02 -070053- name: Copy ssh public key to node_key.pub file
54 copy:
55 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey.pub"
56 dest: "{{ config_cord_profile_dir }}/node_key.pub"
57 mode: 0600
58 remote_src: True
59
Zack Williamsc989f262017-05-11 13:02:59 -070060- name: Copy ssh private key to key_import directory for services that require it
61 copy:
62 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey"
63 dest: "{{ config_cord_profile_dir }}/key_import/{{ item.keypair }}"
64 mode: 0600
65 remote_src: True
66 with_items: "{{ xos_services | selectattr('keypair', 'defined') | list }}"
67
68- name: Copy ssh public key to key_import directory for services that require it
69 copy:
70 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey.pub"
71 dest: "{{ config_cord_profile_dir }}/key_import/{{ item.keypair }}.pub"
72 mode: 0644
73 remote_src: True
74 with_items: "{{ xos_services | selectattr('keypair', 'defined') | list }}"
Zack Williamsa2763112017-01-03 11:38:38 -070075
Andy Baviera6cffe12017-03-15 17:33:42 -040076- name: Copy cert chain and core api key and cert
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040077 copy:
Zack Williams44845c62017-04-21 13:57:14 -070078 src: "{{ pki_dir }}/{{ item.src }}"
Zack Williamsc989f262017-05-11 13:02:59 -070079 dest: "{{ config_cord_profile_dir }}/{{ item.dest }}"
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040080 mode: 0600
81 with_items:
Zack Williams44845c62017-04-21 13:57:14 -070082 - src: "{{ site_name }}_im_ca/private/xos-core.{{ site_suffix }}_key.pem"
83 dest: "core_api_key.pem"
84 - src: "{{ site_name }}_im_ca/certs/xos-core.{{ site_suffix }}_cert_chain.pem"
85 dest: "core_api_cert.pem"
86 - src: "{{ site_name }}_im_ca/certs/im_cert_chain.pem"
87 dest: "im_cert_chain.pem"
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040088
Zack Williamsa2763112017-01-03 11:38:38 -070089- name: Copy over commonly used and utility TOSCA files
90 copy:
91 src: "{{ item }}"
Zack Williamsc989f262017-05-11 13:02:59 -070092 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -070093 with_items:
94 - fixtures.yaml
95 - enable-onboarding.yaml
96 - disable-onboarding.yaml
97
98- name: Create templated XOS configuration files
99 template:
100 src: "{{ item }}.j2"
Zack Williamsc989f262017-05-11 13:02:59 -0700101 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -0700102 mode: 0644
103 with_items:
Matteo Scandolod2221342017-05-25 18:16:57 -0700104 - xos_config.yaml
Zack Williams9cea13e2017-07-25 16:32:59 -0700105 - xos_config_synchronizer.yaml
Zack Williamsa2763112017-01-03 11:38:38 -0700106 - deployment.yaml
107 - xos.yaml
Scott Baker970f24b2017-02-13 14:16:40 -0800108 - gateway-config.yml
Matteo Scandolo667334f2017-02-26 10:58:08 -0800109 - style.config.js
110 - app.config.js
Andy Baviera6cffe12017-03-15 17:33:42 -0400111 - Dockerfile.xos
Andy Baviera6cffe12017-03-15 17:33:42 -0400112 - xos-gui-extensions.yml
Andy Bavier9e7d54a2017-04-17 11:37:02 -0400113 - docker-compose.yml
Matteo Scandoloc4f2c5f2017-07-12 16:25:08 -0700114 - xos-tosca.config.yaml
Zack Williamsa2763112017-01-03 11:38:38 -0700115
116- name: Create profile specific templated TOSCA config files
117 template:
118 src: "{{ item }}.j2"
Zack Williamsc989f262017-05-11 13:02:59 -0700119 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -0700120 with_items: "{{ xos_tosca_config_templates }}"
121
122- name: Create profile specific templated non-TOSCA files
123 template:
124 src: "{{ item }}.j2"
Zack Williamsc989f262017-05-11 13:02:59 -0700125 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -0700126 with_items: "{{ xos_other_templates }}"
127
Zack Williamsc989f262017-05-11 13:02:59 -0700128- name: Create OpenStack config and TOSCA onboarding
129 when: use_openstack
130 template:
131 src: "{{ item }}.j2"
132 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Andy Baviera6cffe12017-03-15 17:33:42 -0400133 with_items:
Zack Williamsc989f262017-05-11 13:02:59 -0700134 - openstack.yaml
135 - admin-openrc.sh
Andy Baviera6cffe12017-03-15 17:33:42 -0400136