Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ansible script #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions ansible/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Ansible

Import it using

```ansible
#ansible all -m ping
#ansible-playbook install_packages/main.yml
#ansible-playbook -i ansible/hosts -u elemento-root --become-password-file ansible/psw ansible/main.yml
- name: gluster
hosts: node
become: true
become_user: root
become_method: sudo
tasks:
- name: Install gluster
include_tasks: gluster.yml
```
53 changes: 53 additions & 0 deletions ansible/gluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
- name: centos-release-gluster
yum:
name: centos-release-gluster9

- name: install gluster
package:
name:
- glusterfs-server
when:
- ansible_pkg_mgr == "dnf"

- name: Reload service
systemd:
name: glusterd
enabled: true
state: started

- name: Create a trusted storage pool
gluster.gluster.gluster_peer:
state: present
nodes:
- 10.4.0.4
- 10.4.0.5

- name: create gluster volume
gluster.gluster.gluster_volume:
state: present
name: gv0
bricks: /bricks/gv0
rebalance: yes
cluster:
- 10.4.0.4
- 10.4.0.5
run_once: true

- name: start gluster volume
gluster.gluster.gluster_volume:
state: started
name: gv0

- name: Create vault-share
file:
path: vault-share
state: directory
mode: '0755'

- name: Mount gluster volume
ansible.posix.mount:
path: /mnt/vault-share
src: 127.0.0.1:/gv0
fstype: nfs
opts: defaults,_netdev,vers=3
state: present