Add robot config at onap install
[oom/offline-installer.git] / tools / cicdansible / roles / install / tasks / install.yml
1 #Onap installation tasks
2 #Copy ssh private key used for resource server access
3 - name: "Copy resource server access key"
4   copy:
5     src: "{{ hostvars[groups['resources'][0]].ansible_private_key_file }}"
6     dest: "{{ ansible_user_dir }}/.ssh/res.pem"
7     mode: 0600
8 #Unarchive resources.
9 - name: "Ensure {{ installer_deploy_path }} directory exists"
10   file:
11     path: "{{ installer_deploy_path }}"
12     state: directory
13 - name: "Extract sw resources"
14   unarchive:
15     src: "resources/{{ hostvars[groups['resources'][0]].resources_sw_filename }}"
16     dest: "{{ installer_deploy_path }}"
17 #Generate ansible inventory and extra vars.
18 - name: "Generate ansible inventory for installer"
19   template:
20     src: inventory.yml.j2
21     dest: "{{ installer_deploy_path }}/ansible/inventory/hosts.yml"
22 - name: "generate application specific config overrides"
23   copy:
24     content: "{{ application_config | b64decode }}"
25     dest: "{{ installer_deploy_path }}/ansible/application/application_overrides.yml"
26   # add onap network configuration to overrides
27 - name: "inject onap network information to config overrides"
28   replace:
29     path: "{{ installer_deploy_path }}/ansible/application/application_overrides.yml"
30     regexp: '({{ item.key }}:)\s?.*'
31     replace: '\1 {{ item.value }}'
32   loop: "{{ lines|dict2items }}"
33   vars:
34     lines:
35       openStackPrivateNetId: "{{ (hostvars['localhost'].heat_stack.stack.outputs | selectattr('output_key', 'equalto', 'network_id') | list).0.output_value }}"
36       openStackPrivateSubnetId: "{{ (hostvars['localhost'].heat_stack.stack.outputs | selectattr('output_key', 'equalto', 'subnet_id') | list).0.output_value }}"
37 # This generates a file with locations of resource files in resource host, we
38 # do it only to allow manually running offline installer without
39 # typing them by hand. We cannot use
40 # inventory template because it will be overridden
41 # by application_configuration.yml.
42 - name: Generate resource location file
43   copy:
44     content: |
45       resources_dir: {{ resources_dir }}
46       resources_filename: {{ resources_filename }}
47       aux_resources_filename: {{ aux_resources_filename }}
48       app_data_path: /opt/onap/resources
49     dest: "{{ installer_deploy_path }}/ansible/application/resources.yml"
50 #Run script.
51 - name: "Execute installation"
52   shell:
53     ./run_playbook.sh
54      -e @application/application_configuration.yml -e @application/application_overrides.yml
55      -e @application/resources.yml -i inventory/hosts.yml site.yml
56   args:
57     chdir: "{{ installer_deploy_path }}/ansible"
58   async: "{{ install_timeout }}"
59   when: install_app | bool