blob: b70cbc37ef8bfdeffb7dfa95dd9b1e06751dd156 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
- name: Create skywalking directory
file:
path: /usr/local/skywalking
state: directory
mode: "0755"
owner: root
group: root
- name: Set ownership and permissions for skywalking directory
file:
path: /usr/local/skywalking
state: directory
recurse: yes
owner: root
group: root
mode: "0755"
- name: Download Apache SkyWalking tar file
get_url:
url: "https://dlcdn.apache.org/skywalking/{{ skywalking_version }}/apache-skywalking-apm-{{ skywalking_version }}.tar.gz"
dest: "/usr/local/skywalking/apache-skywalking-apm-{{ skywalking_version }}.tar.gz"
- name: Extract tar file
unarchive:
src: "/usr/local/skywalking/apache-skywalking-apm-{{ skywalking_version }}.tar.gz"
dest: "/usr/local/skywalking"
remote_src: yes
extra_opts: [--strip-components=1]
- name: Check hostgroup size
set_fact:
group_size: "{{ groups['skywalking-oap'] | length }}"
oap_standalone: "{{ [groups['skywalking-oap'][0]] }}"
oap_bundled: "{{ groups['skywalking-oap'][1:] if groups['skywalking-oap'] | length > 1 else [] }}"
- name: Run the OAPSericeInit script
shell: /usr/local/skywalking/bin/oapServiceInit.sh
when: inventory_hostname in oap_standalone
- name: Run the OAPSericeNoInit script
shell: /usr/local/skywalking/bin/oapServiceNoInit.sh
when: inventory_hostname in oap_bundled
- name: Generate systemd unit file for oap service
template:
src: skywalking-oap.service.j2
dest: /usr/lib/systemd/system/skywalking-oap.service
owner: root
mode: "0660"
when: inventory_hostname in groups['skywalking-oap']
- name: Generate systemd unit file for webui service
template:
src: skywalking-ui.service.j2
dest: /usr/lib/systemd/system/skywalking-ui.service
owner: root
mode: "0660"
when: inventory_hostname in groups['skywalking-ui']
- name: Registration of OAP Server address within WebUI environment file
ansible.builtin.lineinfile:
path: "{{ env_file }}"
line: "{{ item.key }}={{ item.value }}"
create: yes
loop: "{{ sw_ui_env_vars|dict2items }}"
- name: Reload systemd
systemd:
daemon_reload: yes
- name: Link and enable skywalking-oap service
systemd:
name: skywalking-oap
enabled: yes
when: inventory_hostname in groups['skywalking-oap']
- name: Link and enable skywalking-ui service
systemd:
name: skywalking-ui
enabled: yes
when: inventory_hostname in groups['skywalking-ui']
- name: Start SkyWalking-OAP service
systemd:
name: skywalking-oap
state: started
when: inventory_hostname in groups['skywalking-oap']
- name: Start SkyWalking-UI service
systemd:
name: skywalking-ui
state: started
when: inventory_hostname in groups['skywalking-ui']