blob: 5831a161285b853f547be9d38151d26e4f5e92d3 [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
Zack Williams5223dd92017-02-28 23:38:02 -070036- name: Copy ssh public key to node_key.pub file
37 copy:
38 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey.pub"
39 dest: "{{ config_cord_profile_dir }}/node_key.pub"
40 mode: 0600
41 remote_src: True
42
Zack Williamsc989f262017-05-11 13:02:59 -070043- name: Copy ssh private key to key_import directory for services that require it
44 copy:
45 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey"
46 dest: "{{ config_cord_profile_dir }}/key_import/{{ item.keypair }}"
47 mode: 0600
48 remote_src: True
49 with_items: "{{ xos_services | selectattr('keypair', 'defined') | list }}"
50
51- name: Copy ssh public key to key_import directory for services that require it
52 copy:
53 src: "{{ ssh_pki_dir }}/client_certs/{{ pod_sshkey_name }}_sshkey.pub"
54 dest: "{{ config_cord_profile_dir }}/key_import/{{ item.keypair }}.pub"
55 mode: 0644
56 remote_src: True
57 with_items: "{{ xos_services | selectattr('keypair', 'defined') | list }}"
Zack Williamsa2763112017-01-03 11:38:38 -070058
Andy Baviera6cffe12017-03-15 17:33:42 -040059- name: Copy cert chain and core api key and cert
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040060 copy:
Zack Williams44845c62017-04-21 13:57:14 -070061 src: "{{ pki_dir }}/{{ item.src }}"
Zack Williamsc989f262017-05-11 13:02:59 -070062 dest: "{{ config_cord_profile_dir }}/{{ item.dest }}"
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040063 mode: 0600
64 with_items:
Zack Williams44845c62017-04-21 13:57:14 -070065 - src: "{{ site_name }}_im_ca/private/xos-core.{{ site_suffix }}_key.pem"
66 dest: "core_api_key.pem"
67 - src: "{{ site_name }}_im_ca/certs/xos-core.{{ site_suffix }}_cert_chain.pem"
68 dest: "core_api_cert.pem"
69 - src: "{{ site_name }}_im_ca/certs/im_cert_chain.pem"
70 dest: "im_cert_chain.pem"
Andy Bavierf0b5d7d2017-03-15 16:19:03 -040071
Zack Williamsa2763112017-01-03 11:38:38 -070072- name: Copy over commonly used and utility TOSCA files
73 copy:
74 src: "{{ item }}"
Zack Williamsc989f262017-05-11 13:02:59 -070075 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -070076 with_items:
77 - fixtures.yaml
78 - enable-onboarding.yaml
79 - disable-onboarding.yaml
80
81- name: Create templated XOS configuration files
82 template:
83 src: "{{ item }}.j2"
Zack Williamsc989f262017-05-11 13:02:59 -070084 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -070085 mode: 0644
86 with_items:
Matteo Scandolod2221342017-05-25 18:16:57 -070087 - xos_config.yaml
Zack Williamsa2763112017-01-03 11:38:38 -070088 - deployment.yaml
89 - xos.yaml
Scott Baker970f24b2017-02-13 14:16:40 -080090 - gateway-config.yml
Matteo Scandolo667334f2017-02-26 10:58:08 -080091 - style.config.js
92 - app.config.js
Andy Baviera6cffe12017-03-15 17:33:42 -040093 - Dockerfile.xos
Andy Baviera6cffe12017-03-15 17:33:42 -040094 - xos-gui-extensions.yml
Andy Bavier9e7d54a2017-04-17 11:37:02 -040095 - docker-compose.yml
Zack Williamsa2763112017-01-03 11:38:38 -070096
97- name: Create profile specific templated TOSCA config 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_tosca_config_templates }}"
102
103- name: Create profile specific templated non-TOSCA files
104 template:
105 src: "{{ item }}.j2"
Zack Williamsc989f262017-05-11 13:02:59 -0700106 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Zack Williamsa2763112017-01-03 11:38:38 -0700107 with_items: "{{ xos_other_templates }}"
108
Zack Williamsc989f262017-05-11 13:02:59 -0700109- name: Create OpenStack config and TOSCA onboarding
110 when: use_openstack
111 template:
112 src: "{{ item }}.j2"
113 dest: "{{ config_cord_profile_dir }}/{{ item }}"
Andy Baviera6cffe12017-03-15 17:33:42 -0400114 with_items:
Zack Williamsc989f262017-05-11 13:02:59 -0700115 - openstack.yaml
116 - admin-openrc.sh
Andy Baviera6cffe12017-03-15 17:33:42 -0400117