add elastic
This commit is contained in:
parent
a8c0dc7880
commit
67c41a862e
4 changed files with 111 additions and 0 deletions
31
ansible/roles/configure-nfs-client/tasks/main.yml
Normal file
31
ansible/roles/configure-nfs-client/tasks/main.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
- name: install nfs client
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- nfs-common
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: create mount point
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /storage
|
||||
state: directory
|
||||
mode: "0755"
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: add nfs entry to fstab
|
||||
become: true
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/fstab
|
||||
line: "{{ item }}"
|
||||
state: present
|
||||
create: yes
|
||||
with_items:
|
||||
- "10.10.0.7:/storage /storage nfs defaults 0 0"
|
||||
|
||||
- name: mount nfs
|
||||
become: true
|
||||
ansible.builtin.shell:
|
||||
cmd: "mount -a"
|
||||
when: ansible_os_family == "Debian"
|
28
ansible/roles/configure-nfs-server/tasks/main.yml
Normal file
28
ansible/roles/configure-nfs-server/tasks/main.yml
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- name: install nfsd
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- nfs-kernel-server
|
||||
- nfs-common
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: configure nfsd
|
||||
become: true
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/exports
|
||||
line: "{{ item }}"
|
||||
state: present
|
||||
create: yes
|
||||
with_items:
|
||||
- "/storage 10.10.0.4(rw,sync,no_subtree_check,no_root_squash)"
|
||||
- "/storage 10.10.0.5(rw,sync,no_subtree_check,no_root_squash)"
|
||||
- "/storage 10.10.0.6(rw,sync,no_subtree_check,no_root_squash)"
|
||||
|
||||
- name: restart nfsd
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: nfs-kernel-server
|
||||
state: restarted
|
||||
enabled: yes
|
||||
when: ansible_os_family == "Debian"
|
29
ansible/roles/elastic-apt/tasks/main.yml
Normal file
29
ansible/roles/elastic-apt/tasks/main.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- name: Ensure required packages are installed
|
||||
become: true
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
with_items: ["software-properties-common", "gnupg"]
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Add Elastic apt key
|
||||
become: true
|
||||
shell:
|
||||
cmd: "wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elastic-keyring.gpg"
|
||||
register: result
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Print out result
|
||||
debug:
|
||||
msg: "{{ result.stdout }}"
|
||||
|
||||
- name: Add Elastic repository
|
||||
become: true
|
||||
shell:
|
||||
cmd: 'echo "deb [signed-by=/usr/share/keyrings/elastic-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-8.x.list'
|
||||
register: result
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Print out results
|
||||
debug:
|
||||
msg: "{{ result.stdout }}"
|
23
ansible/roles/logging/tasks/main.yml
Normal file
23
ansible/roles/logging/tasks/main.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
- name: Install logstash
|
||||
become: true
|
||||
apt:
|
||||
name: logstash
|
||||
state: present
|
||||
update_cache: yes
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Start and enable logstash
|
||||
become: true
|
||||
service:
|
||||
name: logstash
|
||||
state: started
|
||||
enabled: yes
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Copy logstash config file
|
||||
become: true
|
||||
copy:
|
||||
src: logstash.conf
|
||||
dest: /etc/logstash/conf.d/logstash.conf
|
||||
when: ansible_os_family == "Debian"
|
Loading…
Reference in a new issue