Skip to content

Commit

Permalink
Merge ansible playbooks
Browse files Browse the repository at this point in the history
  • Loading branch information
arcimboldo committed Oct 22, 2014
2 parents 7b52878 + 704749b commit e9eedae
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
tail -1 |sed 's/\s*key\s*=\s*//g' | grep =$ ||
ceph-authtool /etc/ceph/ceph.mon.keyring --gen-key -n mds.$idx -p --cap mds 'allow *' --cap osd 'allow *' --cap mon 'allow rwx'| grep =$
when: inventory_hostname == groups.ceph_mon[0]
with_items: "{{groups.ceph_mds}}"
with_items: groups.ceph_mds
tags:
- ceph
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Check if partition is ceph-active
when: '{{ceph_devs.{{devs}} }}.state != "active"'
when: ceph_devs.{{devs}}.state != "active"
action: shell umount {{devs}}; umount {{osd_disk}}; ceph-disk-prepare --zap-disk {{osd_disk}}
tags:
- ceph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
action: service name=rpcbind state=started enabled=yes
when: is_centos

- name: Ensure portmap is running (Ubuntu prior Trusty Thar)
- name: Ensure portmap is running (Ubuntu prior to Trusty Thar)
action: service name=portmap state=started enabled=yes
when: is_ubuntu|bool and ansible_lsb.major_release|int < 14
when: is_ubuntu|bool and ansible_lsb.major_release is defined and ansible_lsb.major_release|int < 14

- name: Ensure rpcbind is running (Ubuntu on Trusty Tahr or newer)
- name: Ensure rpcbind is running (Ubuntu Trusty Tahr or newer)
action: service name=rpcbind state=started enabled=yes
when: is_ubuntu|bool and ansible_lsb.major_release|int >= 14
when: is_ubuntu|bool and ansible_lsb.major_release is defined and ansible_lsb.major_release|int >= 14

- name: Ensure rpcbind is running (Debian)
action: service name=rpcbind state=started enabled=yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
tags:
- gluster

- name: Create mountpoing
- name: Create mountpoint
action: file path=/glusterfs state=directory
tags:
- gluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
with_items:
- glusterfs-server
- glusterfs-client
- attr
when: is_debian_or_ubuntu
tags:
- gluster
Expand Down Expand Up @@ -76,6 +77,26 @@
tags:
- gluster

- name: Check if all the bricks have been added
shell: for brick in {{gluster_bricks.stdout}}; do gluster volume info {{gluster_volume}} | grep -q $brick || echo -n "$brick "; done; true
register: missing_bricks
when: inventory_hostname == groups.gluster_data[0]
tags:
- gluster

- name: Ensure bricks are clean
shell: gluster volume info | grep -q $(hostname):{{gluster_brick_dir}} || (setfattr -x trusted.glusterfs.volume-id {{gluster_brick_dir}};
setfattr -x trusted.gfid {{gluster_brick_dir}};
rm -rf {{gluster_brick_dir}}/.glusterfs)
tags:
- gluster

- name: Add missing bricks
shell: test -n "{{missing_bricks.stdout}}" && gluster volume add-brick {{gluster_volume}} {{missing_bricks.stdout}} force
when: inventory_hostname == groups.gluster_data[0]
tags:
- gluster

- name: Start default volume
shell: 'gluster volume info {{gluster_volume}} | grep "Status: Started" ||
gluster volume start {{gluster_volume}}'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: patch munge on Ubuntu 14.04
lineinfile: dest=/etc/default/munge line='OPTIONS="--force"' regexp='^OPTIONS=' state=present
when: is_ubuntu and ansible_lsb.release == '14.04'
when: is_ubuntu_trusty
tags:
- munge

Expand Down
6 changes: 3 additions & 3 deletions elasticluster/providers/ansible-playbooks/roles/vars/os
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ is_ubuntu: "'{{ansible_distribution}}' == 'Ubuntu'"
is_debian: "'{{ansible_distribution}}' == 'Debian'"
is_debian_or_ubuntu: "'{{ansible_distribution}}' in ['Ubuntu', 'Debian']"
is_centos: "'{{ansible_distribution}}' == 'CentOS'"
is_ubuntu_precise: "{{is_debian_or_ubuntu}} and '{{ansible_distribution_release}}' == 'precise'"
is_ubuntu_raring: "{{is_debian_or_ubuntu}} and '{{ansible_distribution_release}}' == 'raring'"
is_ubuntu_trusty: "{{is_debian_or_ubuntu}} and '{{ansible_distribution_release}}' == 'trusty'"
is_ubuntu_precise: "{{is_ubuntu}} and '{{ansible_distribution_release}}' == 'precise'"
is_ubuntu_raring: "{{is_ubuntu}} and '{{ansible_distribution_release}}' == 'raring'"
is_ubuntu_trusty: "{{is_ubuntu}} and '{{ansible_distribution_release}}' == 'trusty'"

0 comments on commit e9eedae

Please sign in to comment.