Skip to content

Instantly share code, notes, and snippets.

@chuckersjp
Last active May 13, 2020 21:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save chuckersjp/36994051b72f572bcd2af2d86163a291 to your computer and use it in GitHub Desktop.
Save chuckersjp/36994051b72f572bcd2af2d86163a291 to your computer and use it in GitHub Desktop.
---
- name: Create partitions on master
hosts: masters
become: yes
tasks:
- name: Create LVEtcd logical volume
lvol:
lv: LVEtcd
size: 10g
vg: vg1
- name: Create mount /var/lib/etcd point
file:
path: /var/lib/etcd
state: directory
mode: 0755
- name: Create /dev/mapper/vg1-LVEtcd file system
filesystem:
dev: /dev/mapper/vg1-LVEtcd
fstype: xfs
force: no
- name: Add comment line to end of /etc/fstab
lineinfile:
path: /etc/fstab
line: "\n# OpenShift specific mounts\n"
insertafter: EOF
- name: Mount /var/lib/etcd directory
mount:
path: /var/lib/etcd
src: /dev/mapper/vg1-LVEtcd
fstype: xfs
opts: defaults
state: present
dump: 1
passno: 2
- name: Create partitions on infra and apps
hosts: infras:apps
become: yes
tasks:
- name: Create LVOrigin
lvol:
lv: LVOrigin
size: 20g
vg: vg1
- name: Create mount /var/lib/origin point
file:
path: /var/lib/origin
state: directory
mode: 0755
- name: Create /dev/mapper/vg1-LVOrigin file system
filesystem:
dev: /dev/mapper/vg1-LVOrigin
fstype: xfs
force: no
- name: Mount /var/lib/origin directory
mount:
path: /var/lib/origin
src: /dev/mapper/vg1-LVOrigin
fstype: xfs
opts: defaults
state: present
dump: 1
passno: 2
- name: Create elasticsearch partition
hosts: INFRA-NODE-02
become: yes
tasks:
- name: Create VG2 volume group
lvg:
vg: vg2
pvs: /dev/sdc
state: present
- name: Create Elastic search volume
lvol:
vg: vg2
lv: LVEs-data
size: 100%FREE
state: present
- name: Create mount /usr/local/es-data
file:
path: /usr/local/es-data
state: directory
mode: 0777
seuser: system_u
serole: object_r
setype: container_file_t
selevel: s0
- name: Create /dev/mapper/vg2-LVEs--data file system
filesystem:
dev: /dev/mapper/vg2-LVEs--data
fstype: xfs
force: no
- name: Mount /usr/local/es-data directory
mount:
path: /usr/local/es-data
src: /dev/mapper/vg2-LVEs--data
fstype: xfs
opts: defaults
state: present
dump: 1
passno: 2
- name: Change the SELinux context for /usr/local/es-data
sefcontext:
target: "/usr/local/es-data(/.*)?"
setype: container_file_t
state: present
reload: True
@chuckersjp
Copy link
Author

This is an ansible playbook that creates and sets up some partitions used for an OpenShift deployment. A number of assumptions are made such as the Volume Groups and locations of Elastic Search nodes. The host name for the ES node will need to be changed.

@chuckersjp
Copy link
Author

Renamed file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment