blob: aa17d52e8ad3ee9309f4c76fc9f715b082f96d19 [file] [log] [blame]
---
# cord-profile/tasks/main.yml
# Constructs a CORD service profile directory and configuration files
- name: Create cord_profile directory
become: yes
file:
path: "{{ cord_profile_dir }}"
state: directory
mode: 0755
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_gid }}"
- name: Create cord_profile/profile_name with the name of the profile
copy:
dest: "{{ cord_profile_dir }}/profile_name"
content: "{{ cord_profile }}"
mode: 0644
- name: Create subdirectories inside cord_profile directory
file:
path: "{{ cord_profile_dir }}/{{ item }}"
state: directory
mode: 0755
with_items:
- key_import
- onboarding-docker-compose
- images
- name: Copy ssh keys to key_import directory
copy:
remote_src: True # file is local to the remote machine
src: "{{ item.source_path | expanduser }}"
dest: "{{ cord_profile_dir }}/key_import/{{ item.name }}"
mode: 0600
with_items: "{{ xos_service_sshkeys }}"
- name: Copy over core api key
copy:
src: "{{ playbook_dir }}/pki/intermediate_ca/private/xos-core.{{ site_suffix }}_key.pem"
dest: "{{ cord_profile_dir }}/core_api_key.pem"
mode: 0600
- name: Copy over core api cert
copy:
src: "{{ playbook_dir }}/pki/intermediate_ca/certs/xos-core.{{ site_suffix }}_cert_chain.pem"
dest: "{{ cord_profile_dir }}/core_api_cert.pem"
- name: Make Image directory ( outside of profile directory to avoid repeat downloads on sequential runs)
become: yes
file:
path: "{{ cord_dir }}/images"
state: directory
mode: 0755
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_gid }}"
- name: Download Glance VM images
get_url:
url: "{{ item.url }}"
checksum: "{{ item.checksum }}"
dest: "{{ cord_dir }}/images/{{ item.name }}.qcow2"
with_items: "{{ xos_images }}"
- name: Copy Glance VM images to profile directory
copy:
remote_src: True
src: "{{ cord_dir }}/images/{{ item.name }}.qcow2"
dest: "{{ cord_profile_dir }}/images/{{ item.name }}.qcow2"
with_items: "{{ xos_images }}"
- name: Copy over commonly used and utility TOSCA files
copy:
src: "{{ item }}"
dest: "{{ cord_profile_dir }}/{{ item }}"
with_items:
- fixtures.yaml
- enable-onboarding.yaml
- disable-onboarding.yaml
- name: Create templated XOS configuration files
template:
src: "{{ item }}.j2"
dest: "{{ cord_profile_dir }}/{{ item }}"
mode: 0644
with_items:
- xos_common_config
- deployment.yaml
- xos.yaml
- xos-bootstrap-docker-compose.yaml
- onboard-chameleon.yaml
- onboard-xos-gui.yaml
- onboard-xos-rest-gw.yaml
- gateway-config.yml
- name: Create profile specific templated TOSCA config files
template:
src: "{{ item }}.j2"
dest: "{{ cord_profile_dir }}/{{ item }}"
with_items: "{{ xos_tosca_config_templates }}"
- name: Create profile specific templated non-TOSCA files
template:
src: "{{ item }}.j2"
dest: "{{ cord_profile_dir }}/{{ item }}"
with_items: "{{ xos_other_templates }}"
- name: Copy admin_openrc.sh
when: use_openstack
copy:
remote_src: True
src: "{{ ansible_user_dir }}/admin-openrc.sh"
dest: "{{ cord_profile_dir }}/admin-openrc.sh"
- name: Copy node_key to cord_profile directory
when: use_openstack
copy:
remote_src: True # file is local to the remote machine
src: "{{ ansible_user_dir }}/node_key"
dest: "{{ cord_profile_dir }}/node_key"
mode: 0600