-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.yml
108 lines (98 loc) · 3.63 KB
/
update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
- name: Collecting Info
hosts: undercloud:overcloud_nodes:!unused
gather_facts: yes
any_errors_fatal: true
vars:
discovery_types:
- rhos_release_file
- nova
tags:
- update_collect_info
roles:
- version-discovery
- name: Undercloud Validation
hosts: undercloud
gather_facts: yes
any_errors_fatal: true
vars:
overcloud_deploy_script: "{{ install.overcloud.script|default('~/overcloud_deploy.sh') }}"
reg_file: "environment-rhel-registration.yaml"
tags:
- update_validation
- update_undercloud_validation
tasks:
- name: Set overcloud_deploy script as executable when provided by user
file:
path: "{{ install.overcloud.script }}"
state: touch
mode: 0755
when: install.overcloud.get('script', False)
- name: Validation
include_tasks: "tasks/update/undercloud_validation.yml"
- name: check for cdn registration env file
command: grep "{{ reg_file }}" {{ overcloud_deploy_script }}
failed_when: false
register: cdn_status
- name: set fact oc registered
set_fact:
oc_cdn_register: "{{ cdn_status.rc }}"
- name: Update Overcloud repos
hosts: overcloud_nodes:!unused
gather_facts: yes
any_errors_fatal: true
tags:
- update
- update_repos
vars:
rhos_release_rpm: "https://url.corp.redhat.com/rhos-release-latest-rpm"
roles:
- role: rhos-release
release: "{{ (undercloud_version|int) }}"
rr_buildmods: "{{ install.buildmods }}"
director_build: "{{ install.get('director', {}).build|default(omit) }}"
build: "{{ install.build|default('latest') }}"
mirror: "{{ install.mirror | default(omit) }}"
rr_distro_version: "{{ install.osrelease|default(omit) }}"
enable_testing_repos: "{{ install.get('enable', {}).get('testing', {}).repos|default(omit) }}"
when: hostvars[groups['undercloud'][0]]['oc_cdn_register']|int == 1
- name: Prepare Containerized Environment
hosts: undercloud
gather_facts: no
any_errors_fatal: true
tags:
- update_prepare_containers
vars:
template_base: "{{ ansible_user_dir }}/{{ install.deployment.files | basename }}"
roles:
- role: containers/prepare-templates
when: undercloud_version|openstack_release > 11
- name: Overcloud Minor Update
hosts: undercloud
gather_facts: yes
any_errors_fatal: true
vars:
undercloud_rc: "~/stackrc"
overcloud_rc: "{{ ansible_user_dir }}/{{ install.overcloud.stack }}rc"
overcloud_deploy_script: "{{ install.overcloud.script|default('~/overcloud_deploy.sh') }}"
overcloud_update_script: "~/overcloud_update.sh"
overcloud_update_plan: "~/overcloud_update_plan.sh"
loss_threshold: 1
tags:
- update
tasks:
- name: update deployment plan in Mistral
include_tasks: tasks/update/common/update_mistral_plan.yaml
when: undercloud_version|openstack_release in [10, 11]
- name: Scan nodes ssh keys
command: "ssh-keyscan -t rsa {{ hostvars[item].ansible_host|
default(hostvars[item].ansible_ssh_host) }}"
with_items: "{{ groups.overcloud_nodes|default([])|difference(groups.unused|default([])) }}"
register: pubkeys
- name: Add nodes to known_hosts
known_hosts:
name: "{{ hostvars[item.item].ansible_host|
default(hostvars[item.item].ansible_ssh_host) }}"
key: "{{ item.stdout }}"
with_items: "{{ pubkeys.results }}"
- name: Overcloud Update
include_tasks: tasks/update/common/update_overcloud.yaml