|
1 | 1 | --- |
2 | 2 | # Run as: |
3 | 3 | # ansible-playbook -i examples/vm_os_upgrade/inventory.yml -e @examples/vm_os_upgrade/vars.yml examples/vm_os_upgrade/main.yml |
4 | | -- name: Create VM |
5 | | - hosts: localhost |
6 | | - connection: local |
7 | | - gather_facts: false |
8 | | - tasks: |
9 | | - - name: Create SSH key |
10 | | - ansible.builtin.include_tasks: 01_create_ssh_key.yml |
11 | | - - name: Upload ISO image |
12 | | - ansible.builtin.include_tasks: 02_upload_iso.yml |
13 | | - - name: Create source VM |
14 | | - ansible.builtin.include_tasks: 03_create_source_vm.yml |
| 4 | +# - name: Create VM |
| 5 | +# hosts: localhost |
| 6 | +# connection: local |
| 7 | +# gather_facts: false |
| 8 | +# tasks: |
| 9 | +# - name: Create SSH key |
| 10 | +# ansible.builtin.include_tasks: 01_create_ssh_key.yml |
| 11 | +# - name: Upload ISO image |
| 12 | +# ansible.builtin.include_tasks: 02_upload_iso.yml |
| 13 | +# - name: Create source VM |
| 14 | +# ansible.builtin.include_tasks: 03_create_source_vm.yml |
15 | 15 |
|
16 | | -- name: Inject data into VM |
17 | | - hosts: "{{ source_vm_name }}" |
18 | | - tasks: |
19 | | - - name: Setup source VM |
20 | | - ansible.builtin.include_tasks: 04_setup_source_vm.yml |
| 16 | +# - name: Inject data into VM |
| 17 | +# hosts: "{{ source_vm_name }}" |
| 18 | +# tasks: |
| 19 | +# - name: Setup source VM |
| 20 | +# ansible.builtin.include_tasks: 04_setup_source_vm.yml |
21 | 21 |
|
22 | | -- name: Clone VM |
23 | | - hosts: localhost |
24 | | - connection: local |
25 | | - gather_facts: false |
26 | | - tasks: |
27 | | - - name: Create clone from source VM |
28 | | - ansible.builtin.include_tasks: 05_clone_from_source.yml |
| 22 | +# - name: Clone VM |
| 23 | +# hosts: localhost |
| 24 | +# connection: local |
| 25 | +# gather_facts: false |
| 26 | +# tasks: |
| 27 | +# - name: Create clone from source VM |
| 28 | +# ansible.builtin.include_tasks: 05_clone_from_source.yml |
29 | 29 |
|
30 | 30 | - name: Upgrade all the packages and kernel before upgrading the distribution version |
31 | 31 | hosts: "{{ cloned_vm_name }}" |
|
37 | 37 | ansible.builtin.apt: |
38 | 38 | upgrade: dist |
39 | 39 |
|
40 | | -- name: Reboot VM |
| 40 | +- name: Reboot cloned VM |
41 | 41 | hosts: localhost |
42 | 42 | connection: local |
43 | 43 | tasks: |
44 | | - - name: Reboot VM after dist-upgrade, since some of them require reboot |
45 | | - scale_computing.hypercore.vm_params: |
46 | | - vm_name: "{{ cloned_vm_name }}" |
47 | | - power_state: reboot |
48 | | - - name: Wait until cloned VM reports its IP address |
49 | | - scale_computing.hypercore.vm_info: |
50 | | - vm_name: "{{ cloned_vm_name }}" |
51 | | - register: cloned_vm_info |
52 | | - until: cloned_vm_info.records.0.nics.0.ipv4_addresses |
53 | | - retries: 60 |
54 | | - delay: 10 |
| 44 | + - name: Reboot VM |
| 45 | + ansible.builtin.include_tasks: 06_reboot_cloned_vm.yml |
55 | 46 |
|
56 | 47 | - name: Upgrade distribution version |
57 | 48 | hosts: "{{ cloned_vm_name }}" |
|
60 | 51 | - name: Upgrade distribution version |
61 | 52 | ansible.builtin.shell: do-release-upgrade -f DistUpgradeViewNonInteractive |
62 | 53 |
|
63 | | -- name: Reboot VM |
| 54 | +- name: Reboot cloned VM |
64 | 55 | hosts: localhost |
65 | 56 | connection: local |
66 | 57 | tasks: |
67 | | - - name: Reboot VM after distribution version upgrade |
68 | | - scale_computing.hypercore.vm_params: |
69 | | - vm_name: "{{ cloned_vm_name }}" |
70 | | - power_state: reboot |
71 | | - - name: Wait until cloned VM reports its IP address |
72 | | - scale_computing.hypercore.vm_info: |
73 | | - vm_name: "{{ cloned_vm_name }}" |
74 | | - register: cloned_vm_info |
75 | | - until: cloned_vm_info.records.0.nics.0.ipv4_addresses |
76 | | - retries: 60 |
77 | | - delay: 10 |
| 58 | + - name: Reboot VM |
| 59 | + ansible.builtin.include_tasks: 06_reboot_cloned_vm.yml |
78 | 60 |
|
79 | | -- name: Check distribution version and upload index.html |
| 61 | +- name: Check distribution version and index.html |
80 | 62 | hosts: "{{ cloned_vm_name }}" |
81 | 63 | gather_facts: true |
82 | 64 | tasks: |
|
89 | 71 | delegate_to: localhost |
90 | 72 | register: url_data |
91 | 73 | failed_when: "'test-html-for-scale-computing-demo' not in url_data.content" |
92 | | - - meta: end_play |
0 commit comments