blob: 830462e79a9f8590c77159e6b17ad7ede9974b07 [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
Zack Williams79286962017-07-10 12:24:37 -07005# if this step fails, may need to include `create-configdirs-become` role to
6# create directory using become.
Zack Williamsa2763112017-01-03 11:38:38 -07007- name: Create cord_profile directory
Zack Williamsa2763112017-01-03 11:38:38 -07008 file:
Zack Williamsc989f262017-05-11 13:02:59 -07009 path: "{{ config_cord_profile_dir }}"
Zack Williamsa2763112017-01-03 11:38:38 -070010 state: directory
11 mode: 0755
12 owner: "{{ ansible_user_id }}"
13 group: "{{ ansible_user_gid }}"
14
Zack Williamsc989f262017-05-11 13:02:59 -070015- name: Create cord_profile/profile_name file containing profile name
Zack Williams2478b302017-02-14 10:42:55 -070016 copy:
Zack Williamsc989f262017-05-11 13:02:59 -070017 dest: "{{ config_cord_profile_dir }}/profile_name"
Zack Williams2478b302017-02-14 10:42:55 -070018 content: "{{ cord_profile }}"
19 mode: 0644
20
Zack Williamsa2763112017-01-03 11:38:38 -070021- name: Create subdirectories inside cord_profile directory
22 file:
Zack Williamsc989f262017-05-11 13:02:59 -070023 path: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -070024 state: directory
25 mode: 0755
26 with_items:
27 - key_import
Zack Williamsa2763112017-01-03 11:38:38 -070028 - images
29
Zack Williamsc989f262017-05-11 13:02:59 -070030- name: Copy ssh private key to node_key file
Zack Williamsa2763112017-01-03 11:38:38 -070031 copy:
Zack Williamsc989f262017-05-11 13:02:59 -070032 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey"
33 dest: "{{ config_cord_profile_dir }}/node_key"
Zack Williamsa2763112017-01-03 11:38:38 -070034 mode: 0600
Andy Bavier1ff4b482017-03-24 09:20:36 -040035 remote_src: True
Zack Williamsc989f262017-05-11 13:02:59 -070036
Zack Williams5223dd92017-02-28 23:38:02 -070037- name: Copy ssh public key to node_key.pub file
38 copy:
39 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey.pub"
40 dest: "{{ config_cord_profile_dir }}/node_key.pub"
41 mode: 0600
42 remote_src: True
43
Zack Williamsc989f262017-05-11 13:02:59 -070044- name: Copy ssh private key to key_import directory for services that require it
45 copy:
46 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey"
47 dest: "{{ config_cord_profile_dir }}/key_import/{{ item.keypair }}"
48 mode: 0600
49 remote_src: True
50 with_items: "{{ xos_services | selectattr('keypair', 'defined') | list }}"
51
52- name: Copy ssh public key to key_import directory for services that require it
53 copy:
54 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey.pub"
55 dest: "{{ config_cord_profile_dir }}/key_import/{{ item.keypair }}.pub"
56 mode: 0644
57 remote_src: True
58 with_items: "{{ xos_services | selectattr('keypair', 'defined') | list }}"
Zack Williamsa2763112017-01-03 11:38:38 -070059
Andy Baviera6cffe12017-03-15 17:33:42 -040060- name: Copy cert chain and core api key and cert
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040061 copy:
Zack Williams44845c62017-04-21 13:57:14 -070062 src: "{{ pki_dir }}/{{ item.src }}"
Zack Williamsc989f262017-05-11 13:02:59 -070063 dest: "{{ config_cord_profile_dir }}/{{ item.dest }}"
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040064 mode: 0600
65 with_items:
Zack Williams44845c62017-04-21 13:57:14 -070066 - src: "{{ site_name }}_im_ca/private/xos-core.{{ site_suffix }}_key.pem"
67 dest: "core_api_key.pem"
68 - src: "{{ site_name }}_im_ca/certs/xos-core.{{ site_suffix }}_cert_chain.pem"
69 dest: "core_api_cert.pem"
70 - src: "{{ site_name }}_im_ca/certs/im_cert_chain.pem"
71 dest: "im_cert_chain.pem"
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040072
Zack Williamsa2763112017-01-03 11:38:38 -070073- name: Copy over commonly used and utility TOSCA files
74 copy:
75 src: "{{ item }}"
Zack Williamsc989f262017-05-11 13:02:59 -070076 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -070077 with_items:
78 - fixtures.yaml
79 - enable-onboarding.yaml
80 - disable-onboarding.yaml
81
82- name: Create templated XOS configuration files
83 template:
84 src: "{{ item }}.j2"
Zack Williamsc989f262017-05-11 13:02:59 -070085 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -070086 mode: 0644
87 with_items:
Matteo Scandolod2221342017-05-25 18:16:57 -070088 - xos_config.yaml
Zack Williams9cea13e2017-07-25 16:32:59 -070089 - xos_config_synchronizer.yaml
Zack Williamsa2763112017-01-03 11:38:38 -070090 - deployment.yaml
91 - xos.yaml
Scott Baker970f24b2017-02-13 14:16:40 -080092 - gateway-config.yml
Matteo Scandolo667334f2017-02-26 10:58:08 -080093 - style.config.js
94 - app.config.js
Andy Baviera6cffe12017-03-15 17:33:42 -040095 - Dockerfile.xos
Andy Baviera6cffe12017-03-15 17:33:42 -040096 - xos-gui-extensions.yml
Andy Bavier9e7d54a2017-04-17 11:37:02 -040097 - docker-compose.yml
Matteo Scandoloc4f2c5f2017-07-12 16:25:08 -070098 - xos-tosca.config.yaml
Zack Williamsa2763112017-01-03 11:38:38 -070099
100- name: Create profile specific templated TOSCA config files
101 template:
102 src: "{{ item }}.j2"
Zack Williamsc989f262017-05-11 13:02:59 -0700103 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -0700104 with_items: "{{ xos_tosca_config_templates }}"
105
106- name: Create profile specific templated non-TOSCA files
107 template:
108 src: "{{ item }}.j2"
Zack Williamsc989f262017-05-11 13:02:59 -0700109 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -0700110 with_items: "{{ xos_other_templates }}"
111
Zack Williamsc989f262017-05-11 13:02:59 -0700112- name: Create OpenStack config and TOSCA onboarding
113 when: use_openstack
114 template:
115 src: "{{ item }}.j2"
116 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Andy Baviera6cffe12017-03-15 17:33:42 -0400117 with_items:
Zack Williamsc989f262017-05-11 13:02:59 -0700118 - openstack.yaml
119 - admin-openrc.sh
Andy Baviera6cffe12017-03-15 17:33:42 -0400120