blob: 2edba246bb22e252ec5f30c310338c84231a46bc [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
5- name: Create cord_profile directory
6 become: yes
7 file:
Zack Williamsc989f262017-05-11 13:02:59 -07008 path: "{{ config_cord_profile_dir }}"
Zack Williamsa2763112017-01-03 11:38:38 -07009 state: directory
10 mode: 0755
11 owner: "{{ ansible_user_id }}"
12 group: "{{ ansible_user_gid }}"
13
Zack Williamsc989f262017-05-11 13:02:59 -070014- name: Create cord_profile/profile_name file containing profile name
Zack Williams2478b302017-02-14 10:42:55 -070015 copy:
Zack Williamsc989f262017-05-11 13:02:59 -070016 dest: "{{ config_cord_profile_dir }}/profile_name"
Zack Williams2478b302017-02-14 10:42:55 -070017 content: "{{ cord_profile }}"
18 mode: 0644
19
Zack Williamsa2763112017-01-03 11:38:38 -070020- name: Create subdirectories inside cord_profile directory
21 file:
Zack Williamsc989f262017-05-11 13:02:59 -070022 path: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -070023 state: directory
24 mode: 0755
25 with_items:
26 - key_import
Zack Williamsa2763112017-01-03 11:38:38 -070027 - images
28
Zack Williamsc989f262017-05-11 13:02:59 -070029- name: Copy ssh private key to node_key file
Zack Williamsa2763112017-01-03 11:38:38 -070030 copy:
Zack Williamsc989f262017-05-11 13:02:59 -070031 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey"
32 dest: "{{ config_cord_profile_dir }}/node_key"
Zack Williamsa2763112017-01-03 11:38:38 -070033 mode: 0600
Andy Bavier1ff4b482017-03-24 09:20:36 -040034 remote_src: True
Zack Williamsc989f262017-05-11 13:02:59 -070035
36- name: Copy ssh private key to key_import directory for services that require it
37 copy:
38 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey"
39 dest: "{{ config_cord_profile_dir }}/key_import/{{ item.keypair }}"
40 mode: 0600
41 remote_src: True
42 with_items: "{{ xos_services | selectattr('keypair', 'defined') | list }}"
43
44- name: Copy ssh public key to key_import directory for services that require it
45 copy:
46 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey.pub"
47 dest: "{{ config_cord_profile_dir }}/key_import/{{ item.keypair }}.pub"
48 mode: 0644
49 remote_src: True
50 with_items: "{{ xos_services | selectattr('keypair', 'defined') | list }}"
Zack Williamsa2763112017-01-03 11:38:38 -070051
Andy Baviera6cffe12017-03-15 17:33:42 -040052- name: Copy cert chain and core api key and cert
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040053 copy:
Zack Williams44845c62017-04-21 13:57:14 -070054 src: "{{ pki_dir }}/{{ item.src }}"
Zack Williamsc989f262017-05-11 13:02:59 -070055 dest: "{{ config_cord_profile_dir }}/{{ item.dest }}"
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040056 mode: 0600
57 with_items:
Zack Williams44845c62017-04-21 13:57:14 -070058 - src: "{{ site_name }}_im_ca/private/xos-core.{{ site_suffix }}_key.pem"
59 dest: "core_api_key.pem"
60 - src: "{{ site_name }}_im_ca/certs/xos-core.{{ site_suffix }}_cert_chain.pem"
61 dest: "core_api_cert.pem"
62 - src: "{{ site_name }}_im_ca/certs/im_cert_chain.pem"
63 dest: "im_cert_chain.pem"
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040064
Zack Williamsa2763112017-01-03 11:38:38 -070065- name: Copy over commonly used and utility TOSCA files
66 copy:
67 src: "{{ item }}"
Zack Williamsc989f262017-05-11 13:02:59 -070068 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -070069 with_items:
70 - fixtures.yaml
71 - enable-onboarding.yaml
72 - disable-onboarding.yaml
73
74- name: Create templated XOS configuration files
75 template:
76 src: "{{ item }}.j2"
Zack Williamsc989f262017-05-11 13:02:59 -070077 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -070078 mode: 0644
79 with_items:
80 - xos_common_config
Matteo Scandolod2221342017-05-25 18:16:57 -070081 - xos_config.yaml
Zack Williamsa2763112017-01-03 11:38:38 -070082 - deployment.yaml
83 - xos.yaml
Scott Baker970f24b2017-02-13 14:16:40 -080084 - gateway-config.yml
Matteo Scandolo667334f2017-02-26 10:58:08 -080085 - style.config.js
86 - app.config.js
Andy Baviera6cffe12017-03-15 17:33:42 -040087 - Dockerfile.xos
Andy Baviera6cffe12017-03-15 17:33:42 -040088 - xos-gui-extensions.yml
Andy Bavier9e7d54a2017-04-17 11:37:02 -040089 - docker-compose.yml
Zack Williamsa2763112017-01-03 11:38:38 -070090
91- name: Create profile specific templated TOSCA config files
92 template:
93 src: "{{ item }}.j2"
Zack Williamsc989f262017-05-11 13:02:59 -070094 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -070095 with_items: "{{ xos_tosca_config_templates }}"
96
97- name: Create profile specific templated non-TOSCA files
98 template:
99 src: "{{ item }}.j2"
Zack Williamsc989f262017-05-11 13:02:59 -0700100 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -0700101 with_items: "{{ xos_other_templates }}"
102
Zack Williamsc989f262017-05-11 13:02:59 -0700103- name: Create OpenStack config and TOSCA onboarding
104 when: use_openstack
105 template:
106 src: "{{ item }}.j2"
107 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Andy Baviera6cffe12017-03-15 17:33:42 -0400108 with_items:
Zack Williamsc989f262017-05-11 13:02:59 -0700109 - openstack.yaml
110 - admin-openrc.sh
Andy Baviera6cffe12017-03-15 17:33:42 -0400111