blob: e23c3f9f18e56354110918158c76cc47dd663b97 (
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
|
---
- name: Gather OpenShift Logging Facts
openshift_logging_facts:
oc_bin: "{{openshift.common.client_binary}}"
admin_kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig"
openshift_logging_namespace: "{{openshift_logging_namespace}}"
tags: logging_facts
check_mode: no
- name: Validate Elasticsearch cluster size
fail: msg="The openshift_logging_es_cluster_size may only be scaled down manually. Please see official documentation on how to do this."
when: openshift_logging_facts.elasticsearch.deploymentconfigs | length > openshift_logging_es_cluster_size|int
- name: Validate Elasticsearch Ops cluster size
fail: msg="The openshift_logging_es_ops_cluster_size may only be scaled down manually. Please see official documentation on how to do this."
when: openshift_logging_facts.elasticsearch_ops.deploymentconfigs | length > openshift_logging_es_ops_cluster_size|int
- name: Install logging
include: "{{ role_path }}/tasks/install_{{ install_component }}.yaml"
when: openshift_hosted_logging_install | default(true) | bool
with_items:
- support
- elasticsearch
- kibana
- curator
- fluentd
loop_control:
loop_var: install_component
- find: paths={{ mktemp.stdout }}/templates patterns=*.yaml
register: object_def_files
changed_when: no
- slurp: src={{item}}
register: object_defs
with_items: "{{object_def_files.files | map(attribute='path') | list | sort}}"
changed_when: no
- name: Create objects
include: oc_apply.yaml
vars:
- kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
- namespace: "{{ openshift_logging_namespace }}"
- file_name: "{{ file.source }}"
- file_content: "{{ file.content | b64decode | from_yaml }}"
with_items: "{{ object_defs.results }}"
loop_control:
loop_var: file
when: not ansible_check_mode
- include: update_master_config.yaml
- name: Printing out objects to create
debug: msg={{file.content | b64decode }}
with_items: "{{ object_defs.results }}"
loop_control:
loop_var: file
when: ansible_check_mode
# TODO replace task with oc_secret module that supports
# linking when available
- name: Link Pull Secrets With Service Accounts
include: oc_secret.yaml
vars:
kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
subcommand: link
service_account: "{{sa_account}}"
secret_name: "{{openshift_logging_image_pull_secret}}"
add_args: "--for=pull"
with_items:
- default
- aggregated-logging-elasticsearch
- aggregated-logging-kibana
- aggregated-logging-fluentd
- aggregated-logging-curator
register: link_pull_secret
loop_control:
loop_var: sa_account
when: openshift_logging_image_pull_secret is defined
failed_when: link_pull_secret.rc != 0
- name: Scaling up cluster
include: start_cluster.yaml
when: start_cluster | default(true) | bool
|