blob: aa17d52e8ad3ee9309f4c76fc9f715b082f96d19 [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:
8 path: "{{ cord_profile_dir }}"
9 state: directory
10 mode: 0755
11 owner: "{{ ansible_user_id }}"
12 group: "{{ ansible_user_gid }}"
13
Zack Williams2478b302017-02-14 10:42:55 -070014- name: Create cord_profile/profile_name with the name of the profile
15 copy:
16 dest: "{{ cord_profile_dir }}/profile_name"
17 content: "{{ cord_profile }}"
18 mode: 0644
19
Zack Williamsa2763112017-01-03 11:38:38 -070020- name: Create subdirectories inside cord_profile directory
21 file:
22 path: "{{ cord_profile_dir }}/{{ item }}"
23 state: directory
24 mode: 0755
25 with_items:
26 - key_import
27 - onboarding-docker-compose
28 - images
29
30- name: Copy ssh keys to key_import directory
31 copy:
32 remote_src: True # file is local to the remote machine
33 src: "{{ item.source_path | expanduser }}"
34 dest: "{{ cord_profile_dir }}/key_import/{{ item.name }}"
35 mode: 0600
36 with_items: "{{ xos_service_sshkeys }}"
37
Zack Williamsa2763112017-01-03 11:38:38 -070038- name: Copy over core api key
39 copy:
40 src: "{{ playbook_dir }}/pki/intermediate_ca/private/xos-core.{{ site_suffix }}_key.pem"
41 dest: "{{ cord_profile_dir }}/core_api_key.pem"
42 mode: 0600
43
44- name: Copy over core api cert
45 copy:
46 src: "{{ playbook_dir }}/pki/intermediate_ca/certs/xos-core.{{ site_suffix }}_cert_chain.pem"
47 dest: "{{ cord_profile_dir }}/core_api_cert.pem"
48
Zack Williamsc6ff6b32017-02-10 16:35:29 -070049- name: Make Image directory ( outside of profile directory to avoid repeat downloads on sequential runs)
50 become: yes
51 file:
52 path: "{{ cord_dir }}/images"
53 state: directory
54 mode: 0755
55 owner: "{{ ansible_user_id }}"
56 group: "{{ ansible_user_gid }}"
57
Zack Williamsa2763112017-01-03 11:38:38 -070058- name: Download Glance VM images
59 get_url:
60 url: "{{ item.url }}"
61 checksum: "{{ item.checksum }}"
Zack Williamsc6ff6b32017-02-10 16:35:29 -070062 dest: "{{ cord_dir }}/images/{{ item.name }}.qcow2"
63 with_items: "{{ xos_images }}"
64
65- name: Copy Glance VM images to profile directory
66 copy:
67 remote_src: True
68 src: "{{ cord_dir }}/images/{{ item.name }}.qcow2"
Zack Williamsa2763112017-01-03 11:38:38 -070069 dest: "{{ cord_profile_dir }}/images/{{ item.name }}.qcow2"
70 with_items: "{{ xos_images }}"
71
72- name: Copy over commonly used and utility TOSCA files
73 copy:
74 src: "{{ item }}"
75 dest: "{{ cord_profile_dir }}/{{ item }}"
76 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"
84 dest: "{{ cord_profile_dir }}/{{ item }}"
85 mode: 0644
86 with_items:
87 - xos_common_config
88 - deployment.yaml
89 - xos.yaml
90 - xos-bootstrap-docker-compose.yaml
Scott Baker5ca4bd12017-02-10 15:17:06 -080091 - onboard-chameleon.yaml
Scott Baker970f24b2017-02-13 14:16:40 -080092 - onboard-xos-gui.yaml
93 - onboard-xos-rest-gw.yaml
94 - gateway-config.yml
Zack Williamsa2763112017-01-03 11:38:38 -070095
96- name: Create profile specific templated TOSCA config files
97 template:
98 src: "{{ item }}.j2"
99 dest: "{{ cord_profile_dir }}/{{ item }}"
100 with_items: "{{ xos_tosca_config_templates }}"
101
102- name: Create profile specific templated non-TOSCA files
103 template:
104 src: "{{ item }}.j2"
105 dest: "{{ cord_profile_dir }}/{{ item }}"
106 with_items: "{{ xos_other_templates }}"
107
108- name: Copy admin_openrc.sh
109 when: use_openstack
110 copy:
111 remote_src: True
112 src: "{{ ansible_user_dir }}/admin-openrc.sh"
113 dest: "{{ cord_profile_dir }}/admin-openrc.sh"
114
Zack Williams2a5f6862017-02-09 16:39:52 -0700115- name: Copy node_key to cord_profile directory
116 when: use_openstack
117 copy:
118 remote_src: True # file is local to the remote machine
119 src: "{{ ansible_user_dir }}/node_key"
120 dest: "{{ cord_profile_dir }}/node_key"
121 mode: 0600
122