Last active
August 29, 2015 14:02
-
-
Save weirdbricks/e7019a942f72b7760499 to your computer and use it in GitHub Desktop.
MooseFS Chunk Server Ansible recipe for FreeBSD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
remote_user: root | |
tasks: | |
- name: test | |
raw: uptime | |
- name: ping them | |
ping: | |
- name: install moosefs chunkserver from packages | |
pkgng: name=moosefs-chunkserver state=present | |
- name: remove stale configuration files /usr/local/etc/mfschunkserver.cfg | |
file: dest=/usr/local/etc/mfschunkserver.cfg state=absent | |
- name: remove stale configuration files /usr/local/etc/mfshdd.cfg | |
file: dest=/usr/local/etc/mfshdd.cfg state=absent | |
- name: mv chunkserver configuration into place | |
command: mv /usr/local/etc/mfs/mfschunkserver.cfg.dist /usr/local/etc/mfs/mfschunkserver.cfg creates=/usr/local/etc/mfs/mfschunkserver.cfg | |
- name: mv chunkserver hdd configuration into place | |
command: mv /usr/local/etc/mfs/mfshdd.cfg.dist /usr/local/etc/mfs/mfshdd.cfg creates=/usr/local/etc/mfs/mfshdd.cfg | |
- name: change user to mfs | |
lineinfile: dest=/usr/local/etc/mfs/mfschunkserver.cfg insertafter=EOF line="WORKING_USER = mfs" | |
- name: change group to mfs | |
lineinfile: dest=/usr/local/etc/mfs/mfschunkserver.cfg insertafter=EOF line="WORKING_GROUP = mfs" | |
- name: set the IP of the master to 192.168.2.101 | |
lineinfile: dest=/usr/local/etc/mfs/mfschunkserver.cfg insertafter=EOF line="MASTER_HOST = 192.168.2.101" | |
- name: add the mfschunkserver service to /etc/rc.conf | |
lineinfile: dest=/etc/rc.conf insertafter=EOF line='mfschunkserver_enable="YES"' | |
- name: use dd to create a 'dedicated filesystem', the file will be created only if it doesn't exist | |
command: dd if=/dev/zero of=/root/mfschunks1 bs=1m count=1k creates=/root/mfschunks1 | |
- name: use the dedicated filesystem as a memory disk, run only if it doesn't exist | |
command: mdconfig -a -t vnode -f /root/mfschunks1 creates=/dev/md0 | |
- name: create a filesystem in the memory disk | |
command: newfs md0 | |
ignore_errors: True | |
- name: create a mount point called /mnt/mfschunks1 | |
file: path=/mnt/mfschunks1 owner=mfs group=mfs state=directory | |
- name: mount the memory disk to mountpoint | |
mount: src=/dev/md0 name=/mnt/mfschunks1 state=mounted fstype=mfs opts=rw,-s1g | |
- name: add an entry for our hard drive | |
lineinfile: dest=/usr/local/etc/mfs/mfshdd.cfg insertafter=EOF line="/mnt/mfschunks1" | |
- name: set the correct permissions for the /var/mfs directory | |
file: path=/var/mfs owner=mfs group=mfs state=directory | |
- name: create symlink for mfschunkserver.cfg | |
file: src=/usr/local/etc/mfs/mfschunkserver.cfg dest=/usr/local/etc/mfschunkserver.cfg state=link | |
- name: start the mfschunkserver service | |
service: name=mfschunkserver state=started |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment