| --- |
| # 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 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: Download Glance VM images |
| get_url: |
| url: "{{ item.url }}" |
| checksum: "{{ item.checksum }}" |
| 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 |
| |
| - 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 |
| |