summaryrefslogtreecommitdiffstats
path: root/xci/installer/osh/playbooks/roles/prepare-opnfvhost-osh/tasks/main.yml
blob: 72ae821fefd08bd6132b53ad55eac5b8758ad736 (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
---
- name: Set kubernetes service account permissions
  command: "kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default"
  changed_when: false

- name: Set kubernetes node labels
  command: "kubectl label nodes {{ item }} {{ node_labels[item]|join(' ') }}"
  changed_when: false
  with_items: "{{ groups['kube-node'] }}"

- name: Create directories
  file:
    path: /root/{{ item }}
    state: directory
  with_items:
    ['repos','tmp', '.helm/repository/local']

- name: Rename bifrost clouds file to get it out of precedence
  command: "mv .config/openstack/clouds.yaml .config/openstack/clouds.yaml.bifrost"
  changed_when: false

- name: Clone openstack-helm
  git:
    repo: "{{ osh_git_url }}"
    dest: /root/repos/openstack-helm
    version: "{{ osh_version }}"
    update: true
    force: true
  register: git_clone
  until: git_clone is success
  retries: 2
  delay: 5

- name: Fix dns nameserver for openstack installation (mini flavor)
  lineinfile:
    path: /root/repos/openstack-helm/tools/gate/files/heat-public-net-deployment.yaml
    regexp: '10\.96\.0\.10'
    line: "        - 10.233.0.3"

- name: Fix dns nameserver for openstack installation (noha flavor)
  lineinfile:
    path: /root/repos/openstack-helm/tempest/values.yaml
    regexp: 'dns_servers'
    line: "      dns_servers: 10.233.0.3"

- name: Clone openstack-helm-infra
  git:
    repo: "{{ osh_infra_git_url }}"
    dest: /root/repos/openstack-helm-infra
    version: "{{ osh_infra_version }}"
    update: true
    force: true
  register: git_clone
  until: git_clone is success
  retries: 2
  delay: 5

- name: Get helm
  get_url:
    url: "{{ osh_helm_binary_url }}/helm-{{ osh_helm_binary_version }}-linux-amd64.tar.gz"
    dest: tmp

- name: Uncompress helm package
  command: "tar zxvf  tmp/helm-{{ osh_helm_binary_version }}-linux-amd64.tar.gz --strip-components=1 -C tmp/"
  changed_when: false
  tags:
    - skip_ansible_lint

- name: Put helm in system binaries
  copy:
    src: tmp/helm
    dest: /usr/bin/helm
    remote_src: yes
    mode: 0755

- name: Create helm-serve service file
  copy:
    src: helm-serve.service
    dest: "/etc/systemd/system/helm-serve.service"
    mode: 0640

- name: Start helm-serve service
  service:
    name: helm-serve
    state: started
    enabled: yes

- name: Wait for helm-serve service to start
  wait_for:
    port: 8879
    host: 127.0.0.1

- name: Install pyhelm
  pip:
    name: pyhelm

- name: Init helm
  command: "helm init"
  changed_when: false

- name: Remove stable (external) service from helm
  command: "helm repo remove stable"
  changed_when: false

- name: Add local repositories service to helm
  command: "helm repo add local http://localhost:8879/charts"
  changed_when: false

- name: Make charts from infra
  make:
    chdir: /root/repos/openstack-helm-infra
    target: "{{ item }}"
  with_items:
    - helm-toolkit
    - ingress
    - mariadb
    - rabbitmq
    - memcached
    - ceph-mon
    - ceph-osd
    - ceph-client
    - ceph-provisioners
    - ceph-rgw
    - openvswitch
    - libvirt

- name: Install packages
  package:
    name: "{{ required_packages }}"
    state: present