You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

152 lines
3.4 KiB

4 years ago
---
- hosts: service
remote_user: "{{ user }}"
gather_facts: no
vars:
user: "zeus"
tasks:
# ------------------------
# apt update
# -------------------------
- name: apt update packages
become: true
apt:
update_cache: 'yes'
force_apt_get: 'yes'
upgrade: 'dist'
cache_valid_time: 3600
install_recommends: true
autoremove: true
# ------------------------
# apt install packages
# -------------------------
- name: apt install packages
become: true
apt:
update_cache: 'yes'
force_apt_get: 'yes'
install_recommends: true
autoremove: true
name: "{{ packages }}"
vars:
packages:
- build-essential
- git
- flex
- bison
- traceroute
- curl
- lynx
- ruby
- ruby-dev
# ------------------------
# directory4example fluentd
# -------------------------
- name: make /var/log-in
become: true
file:
path: "/var/log-in"
state: directory
owner: "{{ ruser }}"
group: "{{ ruser }}"
mode: '0777'
# ------------------------
# gem begin
# -------------------------
- name: make dir for gem
become: true
file:
path: "/home/{{ ruser }}/.gem"
state: directory
owner: "{{ ruser }}"
group: "{{ ruser }}"
mode: '0755'
- name: gem install fluentd
#become: true
gem:
name: fluentd
version: 1.12.0
state: present
environment:
CONFIGURE_OPTS: '--disable-install-doc'
PATH: "/home/{{ ruser }}/.gem/ruby/2.5.0/bin:{{ ansible_env.PATH }}"
- name: gem install fluent-plugin-mongo
#become: true
gem:
name: fluent-plugin-mongo
state: present
- name: gem install oj
#become: true
gem:
name: oj
state: present
- name: gem install json
#become: true
gem:
name: json
state: present
- name: gem install async-http
#become: true
gem:
name: async-http
version: 0.54.0
state: present
- name: gem install ext-monitor
#become: true
gem:
name: ext_monitor
version: 0.1.2
state: present
# ------------------------
# mkdir directory4 fluent
# -------------------------
- name: make dir fluentd
become: true
file:
path: "/fluentd/etc"
state: directory
owner: "{{ ruser }}"
group: "{{ ruser }}"
mode: '0755'
- name: make dir fluentd
become: true
file:
path: "/fluentd/plugins"
state: directory
owner: "{{ ruser }}"
group: "{{ ruser }}"
mode: '0755'
# ------------------------
# cp fluentd.conf
# -------------------------
- name: cp fluentd.conf
become: true
copy:
src: "./files/fluent.conf"
dest: /fluentd/etc/fluent.conf
owner: "{{ ruser }}"
group: "{{ ruser }}"
mode: 0755
# ------------------------
# start fluentd
# -------------------------
# - name: start fluentd background
# shell: "nohup /home/{{ ruser }}/.gem/ruby/2.5.0/bin/fluentd -c /fluentd/etc/fluent.conf -vv </dev/null >/dev/null 2>&1 &"