-
Notifications
You must be signed in to change notification settings - Fork 0
/
splitstack.yml
119 lines (105 loc) · 4.3 KB
/
splitstack.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
109
110
111
112
113
114
115
116
117
118
119
---
- name: Prepare overcloud nodes
hosts: overcloud_nodes:!unused
any_errors_fatal: true
gather_facts: no
become: yes
vars:
local_undercloud_pubkey: "{{ inventory_dir }}/id_rsa_undercloud.pub"
default_privatekey: "~/.ssh/id_rsa"
default_pubkey: "{{ default_privatekey }}.pub"
tmp_oc_repos_dir: /tmp/oc_repos/yum.repos.d
rhos_release_rpm: "https://url.corp.redhat.com/rhos-release-latest-rpm"
tags:
- prepare_splitstack
pre_tasks:
- setup:
- name: check for subscription
command: subscription-manager identity
become: yes
failed_when: false
register: cdn_status
changed_when: false
when: install.images.packages|default('') or install.images['update'] or install.images.remove|default('')
- name: check if rhos-release is available
uri:
url: "{{ rhos_release_rpm }}"
validate_certs: false
ignore_errors: yes
register: internal_repos
when: install.images.packages|default('') or install.images['update'] or install.images.remove|default('')
- fail:
msg: overcloud image customization currently not supported outside Red Hat internal network or when using CDN
when:
- install.images.packages|default('') or install.images['update'] or install.images.remove|default('')
- internal_repos|failed or cdn_status.rc == 0
- name: tmp repos.d for overcloud
file:
name: "{{ tmp_oc_repos_dir }}"
state: directory
roles:
# modify images - update to core build and install packages
- role: rhos-release
release: "{{ install.version }}"
rr_buildmods: "{{ install.buildmods }}"
build: "{{ install.build | default(omit) }}"
director_build: "{{ install.get('director', {}).build|default(omit) }}"
mirror: "{{ install.mirror | default(omit) }}"
rr_target_directory: "{{ tmp_oc_repos_dir }}"
rr_discover_build: yes
rr_distro_version: "{{ install.osrelease|default(omit) }}"
enable_testing_repos: "{{ install.get('enable', {}).get('testing', {}).repos|default(omit) }}"
# when:
# - install.version|default(undercloud_version)|openstack_distribution == 'OSP'
tags: rhos-release
- role: rdo-release
release: "{{ undercloud_version }}"
rr_buildmods: "{{ install.buildmods }}"
build: "{{ install.build | default(omit)}}"
mirror: "{{ install.mirror | default(omit) }}"
rr_target_directory: "{{ tmp_oc_repos_dir }}"
when:
- install.images.packages|default('') or install.images['update'] or install.images.remove|default('')
- undercloud_version|default(undercloud_version)|openstack_distribution == 'RDO'
tags: rhos-release
tasks:
- name: backup old repo data
command: mv -v /etc/yum.repos.d /etc/yum.repos.d_old
- name: make new repo dir active
command: mv -fu "{{ tmp_oc_repos_dir }}" /etc/
- name: sudoers no tty
lineinfile:
dest: /etc/sudoers
state: absent
regexp: 'Defaults\s+requiretty'
- name: create default user
user:
name: "{{ install.user.name }}"
state: present
password: "{{ install.user.password | password_hash('sha512') }}"
- name: add user to sudoers
lineinfile:
dest: "/etc/sudoers"
line: "{{ install.user.name }} ALL=(root) NOPASSWD:ALL"
- name: create .ssh direcotry for non-root user
file:
path: "{{ default_privatekey | dirname }}"
state: directory
become_user: "{{ install.user.name }}"
become: yes
- set_fact:
uc_publickey: "{{ lookup('file', local_undercloud_pubkey) }}"
- name: set up authorized_keys for non root user
authorized_key:
user: "{{ install.user.name }}"
key: "{{ uc_publickey }}"
- name: Install heat-agent package
package:
name: 'python-heat-agent'
state: latest
when: "install.version|openstack_release < 15"
- name: Install python3-heat-agent package
package:
name: 'python3-heat-agent'
state: latest
when: "install.version|openstack_release >= 15"