blob: b8c593b8709889dc18175f67d4151a3af4b58e68 [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 and set permissions for skywalking directory
file:
path: /usr/local/skywalking
state: directory
recurse: yes
owner: skywalking
group: skywalking
mode: "0755"
- name: Download remote Apache SkyWalking tarball
when: skywalking_tarball is match('^https?://.*')
get_url:
url: "{{ skywalking_tarball }}"
dest: /usr/local/skywalking/apache-skywalking-apm.tar.gz
- name: Upload local Apache SkyWalking tarball
when: skywalking_tarball is not match('^https?://.*')
ansible.builtin.copy:
src: "{{ skywalking_tarball }}"
dest: /usr/local/skywalking/apache-skywalking-apm.tar.gz
owner: skywalking
group: skywalking
mode: '0755'
- name: Extract tarball
unarchive:
src: /usr/local/skywalking/apache-skywalking-apm.tar.gz
dest: /usr/local/skywalking
remote_src: yes
owner: skywalking
group: skywalking
extra_opts: [--strip-components=1]
- name: Generate environment file for webui service
template:
src: skywalking-ui.env.j2
dest: /home/skywalking/webapp.env
owner: skywalking
mode: "0660"
when: inventory_hostname in groups['skywalking_ui']
- name: Generate environment file for OAP service
template:
src: skywalking-oap.env.j2
dest: /home/skywalking/oap.env
owner: skywalking
mode: "0660"
when: inventory_hostname in groups['skywalking_oap']
- name: Check hostgroup size
set_fact:
group_size: "{{ groups['skywalking_oap'] | length }}"
oap_init_node: "{{ [groups['skywalking_oap'][0]] }}"
- name: Run the OAPSericeInit script
command: "sudo -u skywalking /usr/local/skywalking/bin/oapServiceInit.sh"
when: inventory_hostname in oap_init_node
- 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: 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']