Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 1 | --- |
| 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 Williams | 2478b30 | 2017-02-14 10:42:55 -0700 | [diff] [blame^] | 14 | - 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 Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 20 | - 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 Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 38 | - 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 Williams | c6ff6b3 | 2017-02-10 16:35:29 -0700 | [diff] [blame] | 49 | - 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 Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 58 | - name: Download Glance VM images |
| 59 | get_url: |
| 60 | url: "{{ item.url }}" |
| 61 | checksum: "{{ item.checksum }}" |
Zack Williams | c6ff6b3 | 2017-02-10 16:35:29 -0700 | [diff] [blame] | 62 | 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 Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 69 | 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 Baker | 5ca4bd1 | 2017-02-10 15:17:06 -0800 | [diff] [blame] | 91 | - onboard-chameleon.yaml |
Scott Baker | 970f24b | 2017-02-13 14:16:40 -0800 | [diff] [blame] | 92 | - onboard-xos-gui.yaml |
| 93 | - onboard-xos-rest-gw.yaml |
| 94 | - gateway-config.yml |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 95 | |
| 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 Williams | 2a5f686 | 2017-02-09 16:39:52 -0700 | [diff] [blame] | 115 | - 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 | |