aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/config-osa/tasks/main.yml
blob: d96a83da2149c1a289c5ceb5ccd0cea0eac6ad60 (plain)
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# #############################################################################
# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# #############################################################################
---
- name: create osa log directory
  file:
    path: /var/log/osa/
    state: directory

- name: disable kernel update in rt_kvm scenario
  lineinfile:
    dest: /etc/ansible/roles/openstack_hosts/vars/ubuntu-16.04.yml
    state: absent
    regexp: 'linux-image-extra-*'
  when: rt_kvm is defined and rt_kvm == "Enable"

- name: copy openstack_user_config
  template:
    src: openstack_user_config.yml.j2
    dest: /etc/openstack_deploy/openstack_user_config.yml

- name: copy user_variables
  template:
    src: user_variables.yml.j2
    dest: /etc/openstack_deploy/user_variables.yml

- name: check apt source
  shell: "ping -c 2 {{ LOCAL_REPOSITORY_IP }} > /dev/null"
  register: checkresult
  ignore_errors: "true"

- name: add mariadb local repository
  blockinfile:
    dest: /etc/openstack_deploy/user_variables.yml
    block: |
      galera_client_apt_repo_url: "http://192.168.137.222/mariadb"
      galera_repo_url: "[ arch=amd64 ] http://192.168.137.222/mariadb"
      uca_apt_repo_url: "[ arch=amd64 ] http://192.168.137.222/ubuntu-cloud"
  when:
    - checkresult.rc == 0
    - offline_deployment is defined and offline_deployment == "Disable"

# yamllint disable rule:line-length
- name: add mariadb local repository
  blockinfile:
    dest: /etc/openstack_deploy/user_variables.yml
    block: |
      galera_client_apt_repo_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/xenial-ocata-ppa xenial main"
      galera_repo_url: "[ arch=amd64 ] http://{{ offline_repo_ip }}:{{ offline_repo_port }}/xenial-ocata-ppa xenial main"
      uca_apt_repo_url: "[ arch=amd64 ] http://{{ offline_repo_ip }}:{{ offline_repo_port }}/xenial-ocata-ppa xenial main"
      _rabbitmq_package_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/rabbitmq-server_3.6.9-1_all.deb"
      percona_package_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/percona-xtrabackup-24_2.4.5-1.xenial_amd64.deb"
      qpress_package_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/qpress_11-1.xenial_amd64.deb"
      haproxy_hatop_download_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/hatop-0.7.7.tar.gz"
      pip_upstream_url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/get-pip.py"
      ceph_stable_repo: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/xenial-ocata-ppa"
      ceph_pkg_source: "uca"
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: ignore galera client key
  shell: |
    sed -i '/galera-client-apt-keys/a\  when: offline_deployment is defined and offline_deployment == "Disable"' /etc/ansible/roles/galera_client/tasks/galera_client_install_apt.yml
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: ignore galera server key
  shell: |
    sed -i '/galera-apt-keys/a\  when: offline_deployment is defined and offline_deployment == "Disable"' /etc/ansible/roles/galera_server/tasks/galera_install_apt.yml
  when: offline_deployment is defined and offline_deployment == "Enable"
# yamllint enable rule:line-length

- name: ignore git clone
  lineinfile:
    dest: /etc/ansible/roles/repo_build/tasks/repo_clone_git.yml
    insertbefore: '^  async_status:'
    line: '  ignore_errors: true'
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: add pbr to repo_pip_packages
  lineinfile:
    dest: /etc/ansible/roles/repo_build/defaults/main.yml
    insertafter: '^  - cython'
    line: '  - pbr'
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: ignore ceph special ppa
  lineinfile:
    dest: /etc/ansible/roles/ceph.ceph-common/tasks/installs/debian_ceph_repository.yml
    insertafter: '^    - ppa:gluster/nfs-ganesha'
    line: '  ignore_errors: true'
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: remove repo_build_pip_no_binary
  lineinfile:
    dest: /opt/openstack-ansible/playbooks/inventory/group_vars/repo_all.yml
    state: absent
    regexp: "{{ item }}"
  with_items: ['^repo_build_pip_no_binary:', '^  - libvirt-python']
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: copy venv script
  copy:
    src: "op-venv-script.sh"
    dest: "/opt/op-venv-script.sh"
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: update venv script
  blockinfile:
    dest: /etc/ansible/roles/repo_build/tasks/repo_venv_build.yml
    insertbefore: '^- name: Run venv process script'
    block: |
      - name: update venv script
        copy:
          src: "/opt/op-venv-script.sh"
          dest: "/opt/op-venv-script.sh"
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: copy absolute requirement
  copy:
    src: "requirements_absolute_requirements.txt"
    dest: "/opt/requirements_absolute_requirements.txt"
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: update absolute requirements
  blockinfile:
    dest: /etc/ansible/roles/repo_build/tasks/repo_post_build.yml
    insertbefore: '^- name: Copy get-pip script into release folder'
    block: |
      {% raw %}
      - name: update absolute requirements
        copy:
          src: "/opt/requirements_absolute_requirements.txt"
          dest: "{{ repo_build_release_path }}/requirements_absolute_requirements.txt"
      {% endraw %}
  when: offline_deployment is defined and offline_deployment == "Enable"

# This is a bug in ocata, will be removed in the future
- name: limit the version of networking-sfc in os_tacker
  shell: |
    sed -i 's/networking-sfc$/networking-sfc=={{ networking_sfc_version }}/g' \
        /etc/ansible/roles/os_tacker/defaults/main.yml

- name: add rally and tempest to requirement.txt
  blockinfile:
    dest: /etc/ansible/roles/repo_build/tasks/repo_pre_build.yml
    insertbefore: '^- include: repo_clone_git.yml'
    block: |
      {% raw %}
      - name: add rally and tempest
        blockinfile:
          dest: "{{ repo_build_release_path }}/requirements.txt"
          insertafter: '^wheel'
          block: |
            rally
            tempest
      {% endraw %}
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: add lxc image for offline deloyment
  blockinfile:
    dest: /etc/ansible/roles/lxc_hosts/tasks/main.yml
    insertbefore: '^- include: lxc_post_install.yml'
    block: |
      - name: add lxc image to the lxc cache dir
        get_url:
          url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/download.tar.gz"
          dest: "/opt/download.tar.gz"

      - name: unarchive lxc image tarball
        command: su -s /bin/sh -c "tar -zxf /opt/download.tar.gz -C /var/cache/lxc/"

      - name: clear tarball
        file:
          path: "/opt/download.tar.gz"
          state: absent
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: configure pip.conf for lxc hosts and repo lxc
  template:
    src: pip.conf.j2
    dest: "/etc/ansible/roles/pip_install/templates/pip.conf.j2"
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: set set-upper-constraints downloading
  blockinfile:
    dest: /opt/openstack-ansible/playbooks/common-tasks/set-upper-constraints.yml
    insertafter: '^# Use https'
    block: |
      - name: download upper-constraints.txt
        get_url:
          url: "http://{{ offline_repo_ip }}:{{ offline_repo_port }}/upper-constraints.txt"
          dest: /opt/
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: modify set-upper-constraints
  shell: |
    sed -i 's#\(--constraint\).*$#\1 /opt/upper-constraints.txt#g' \
      /opt/openstack-ansible/playbooks/common-tasks/set-upper-constraints.yml ;
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: copy apt.conf for lxc
  copy:
    src: apt.conf
    dest: "/etc/ansible/roles/lxc_container_create/files/apt.conf"
  when: offline_deployment is defined and offline_deployment == "Enable"

- name: add apt.conf for lxc
  blockinfile:
    dest: "/etc/ansible/roles/lxc_container_create/tasks/container_create.yml"
    insertbefore: '^- name: Create hostname'
    block: |
      - name: add apt.conf
        copy:
          src: apt.conf
          dest: "/etc/apt/apt.conf"

  when: offline_deployment is defined and offline_deployment == "Enable"

- name: copy cinder.yml
  copy:
    src: cinder.yml
    dest: /etc/openstack_deploy/env.d/cinder.yml

- name: copy ansible.cfg
  template:
    src: ansible.cfg
    dest: /opt/openstack-ansible/playbooks/

- name: copy user_ceph.yml
  copy:
    src: user_ceph.yml
    dest: /etc/openstack_deploy/user_ceph.yml
  when:
    - hostvars[inventory_hostname]['groups']['ceph_mon'] is defined and
      "{{ hostvars[inventory_hostname]['groups']['ceph_mon'] | length > 0 }}"
    - hostvars[inventory_hostname]['groups']['ceph_osd'] is defined and
      "{{ hostvars[inventory_hostname]['groups']['ceph_osd'] | length > 0 }}"

- name: render ceph.yml.j2
  template:
    src: ceph.yml.j2
    dest: /etc/openstack_deploy/conf.d/ceph.yml
  when:
    - hostvars[inventory_hostname]['groups']['ceph_mon'] is defined and
      "{{ hostvars[inventory_hostname]['groups']['ceph_mon'] | length > 0 }}"
    - hostvars[inventory_hostname]['groups']['ceph_osd'] is defined and
      "{{ hostvars[inventory_hostname]['groups']['ceph_osd'] | length > 0 }}"

- name: render user_variables_ceph.yml.j2
  template:
    src: user_variables_ceph.yml.j2
    dest: /etc/openstack_deploy/user_variables_ceph.yml
  when:
    - hostvars[inventory_hostname]['groups']['ceph_mon'] is defined and
      "{{ hostvars[inventory_hostname]['groups']['ceph_mon'] | length > 0 }}"
    - hostvars[inventory_hostname]['groups']['ceph_osd'] is defined and
      "{{ hostvars[inventory_hostname]['groups']['ceph_osd'] | length > 0 }}"

- name: adapt no ha scenario
  include: noha.yml
  when:
    - "{{ hostvars[inventory_hostname]['groups']['controller'] | length < 2 }}"

- name: copy the repo_fix_andas.yml
  template:
    src: repo_fix_pandas.yml
    dest: /etc/ansible/roles/repo_build/tasks/repo_fix_pandas.yml

- name: change repore build
  lineinfile:
    dest: /etc/ansible/roles/repo_build/tasks/main.yml
    insertafter: "^- include: repo_post_build.yml"
    line: "- include: repo_fix_pandas.yml"

- include: meters.yml