airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [14/50] [abbrv] airavata git commit: Imported mesos ansible scripts to airavata repo
Date Mon, 03 Oct 2016 15:38:34 GMT
Imported mesos ansible scripts to airavata repo


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/7071ef17
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/7071ef17
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/7071ef17

Branch: refs/heads/airavata-gov-registry
Commit: 7071ef173edaa0d4cbddcf8e2246a4d5f0c620cf
Parents: 43b3757 21545be
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Fri Sep 23 21:45:32 2016 -0400
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Fri Sep 23 21:49:08 2016 -0400

----------------------------------------------------------------------
 modules/cloud/ansible-playbooks/README.md       |  82 +++++++++++++
 .../cloud/ansible-playbooks/group_vars/all.yml  |  19 +++
 modules/cloud/ansible-playbooks/hosts           |  13 +++
 .../ansible-playbooks/roles/ec2/tasks/main.yml  |  30 +++++
 .../roles/ec2/vars/aws-credential.yml           |   3 +
 .../ansible-playbooks/roles/ec2/vars/main.yml   |   8 ++
 .../ansible-playbooks/roles/java/tasks/main.yml |  21 ++++
 .../ansible-playbooks/roles/java/vars/main.yml  |  15 +++
 .../roles/mesos-master/tasks/backup_main.yml    | 117 +++++++++++++++++++
 .../roles/mesos-master/tasks/main.yml           |  86 ++++++++++++++
 .../roles/mesos-master/templates/quorum.j2      |   1 +
 .../roles/mesos-master/templates/zk.j2          |   1 +
 .../roles/mesos-slave/tasks/main.yml            |  66 +++++++++++
 .../roles/mesos-slave/templates/zk.j2           |   1 +
 .../ansible-playbooks/roles/test/tasks/main.yml |   3 +
 .../roles/zookeeper/handlers/main.yml           |  15 +++
 .../roles/zookeeper/tasks/main.yml              |  98 ++++++++++++++++
 .../roles/zookeeper/templates/myid.j2           |   1 +
 .../roles/zookeeper/templates/zoo.cfg.j2        |  32 +++++
 .../roles/zookeeper/vars/main.yml               |  15 +++
 modules/cloud/ansible-playbooks/site.yml        |  19 +++
 21 files changed, 646 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/README.md
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/README.md
index 0000000,0000000..9ce4e47
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/README.md
@@@ -1,0 -1,0 +1,82 @@@
++# mesos-deployment
++This project setup Apache Mesos master and slave clusters on Cloud Infrastructures using
Anisble
++
++If you are working with new set of hosts which you haven't ssh login to those host from
the machine you are suppose to run your Ansible play. It will prompt you to get permission
to add to known_hosts list, if you wan't remove this prompt and you know the consequences
of disabling this feature and you want tor remove this prompt behavior run this on your terminal
 `export ANSIBLE_HOST_KEY_CHECKING=False`
++
++## Configurations
++
++To run this ansible script you must have at least 4 instances. 3 instances to setup Mesos
master , marathon and zookeeper clusters. Along with Mesos master we install marathon and
zookeeper. Another one or more instance/s to setup mesos agent/s. You can use ec2 ansible
role provided with this playbook to spin up aws instances. To do that you need to set valid
aws credentials.
++
++1. set valid aws credentials in `roles/ec2/vars/aws-credential.yml` if it doesn't work add
folowing to ec2 task in `roles/ec2/tasks/main.yml`
++
++  `aws_access_key: <your_valid_access_key>`
++
++  `aws_secret_key: <your_valid_secret_key?`
++
++2. Set ec2 instance names under ec2 task `with_items:` configurations
++
++  After you set valid aws credentials and instance names run following ansible playbook
command to spin up require aws ec2 instances.
++
++  `ansible-palybook -i hosts site.yml -t "ec2"`
++
++3.  You need to know public ips of all the nodes and private ips of all mesos-master nodes.
 List all mesos master public ips under `[mesos-master]` section in `hosts` file. List all
mesos-slave *(mesos-agent)* public ips under `[mesos-slave]` section.  You need to set `my_id`
hosts variable along with mesos-master ip addresses. This will use to set zookeeper id.
++
++ > [mesos-master]
++
++ > *1.2.3.4 my_id=1*
++
++ > *11.22.33.44 my_id=2*
++
++ > ...
++
++ > [mesos-slave]
++
++ > *123.123.123.123*
++
++ > ...
++
++4. Use mesos-master private ip addresses to set zookeeper servers properties in `roles/zookeeper/vars/main.yml`
++
++  > zookeeper_servers:
++
++  >  \- {id: "1", ip: "172.31.24.149"}
++
++  >  \- {id: "2", ip: "172.31.19.49"}
++
++  >  \- {id: "3", ip: "172.31.25.80"}
++
++5. Set Mesos-master zookeeper quorum value in `group_vars/all.yml` file
++
++  > zk_quorum: 2
++
++6. Now we are set to deploy Apache Mesos cluster (Mesos-master, marthon, zookeeper, mesos-slave).
Following ansible playbook command respectively setup mesos-master cluster , Mesos-slaves,
and both mesos-master cluster and mesos-slave
++
++  `ansible-playbook -i hosts site.yml  -t "mesos-master"`
++
++  `ansible-playbook -i hosts site.yml  -t "mesos-slave"`
++
++  `ansible-playbook -i hosts site.yml  -t "mesos"`
++
++  If everything works without any error, now you have running mesos cluster on aws instances.
++
++## verifying installation
++
++1.  If your plays works without any error. Now you can access Mesos master console using
`http://<master-ip>:5050` run following in one of Mesos master node to find which instance
is the leader of cluster.
++
++  ``mesos-resolve `cat /etc/mesos/zk` `` this will return master-ip. Then use it to access
console
++
++2. To access marathon console use `http://<master-ip>:8080`
++
++3. If you want run simple task on mesos. run following command on one of master node.
++
++  ``MASTER=$(mesos-resolve `cat /etc/mesos/zk`)``
++
++  `mesos-execute --master=$MASTER --name="cluster-test" --command="sleep 5"`
++
++
++
++## Ansible roles
++- java - install oracle java 8
++- zookeeper - install zookeeper
++- mesos-master - install mesos mastera and marathon
++- mesos-slave  - install mesos slave

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/group_vars/all.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/group_vars/all.yml
index 0000000,0000000..62c83dc
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/group_vars/all.yml
@@@ -1,0 -1,0 +1,19 @@@
++---
++ansible_connection: ssh
++ansible_ssh_user: centos
++ansible_ssh_private_key_file: /Users/syodage/Projects/airavata-ansible/shameera-aws.pem.txt
++
++user: centos
++group: centos
++
++#Zookeeper related properties
++zookeeper_client_port: 2181
++# zookeeper_servers:
++#   - { index: 1, ip: "", ports: "2888:3888"}
++#   - { index: 2, ip: "", ports: "2888:3888"}
++#   - { index: 3, ip: "", ports: "2888:3888"}
++zk_1: "{{ groups['mesos-master'][0] }}"
++zk_2: "{{ groups['mesos-master'][1] }}"
++zk_3: "{{ groups['mesos-master'][2] }}"
++
++zk_quorum: 2

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/hosts
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/hosts
index 0000000,0000000..cc90239
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/hosts
@@@ -1,0 -1,0 +1,13 @@@
++---
++# inventory fie: production
++#[localhost]
++127.0.0.1
++
++[mesos-master]
++52.87.208.230 my_id=1
++54.172.21.138 my_id=2
++54.196.170.54 my_id=3
++
++
++[mesos-slave]
++54.175.143.203

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/ec2/tasks/main.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/ec2/tasks/main.yml
index 0000000,0000000..7a6eb3d
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/ec2/tasks/main.yml
@@@ -1,0 -1,0 +1,30 @@@
++---
++- name: include credentials
++  include_vars: vars/aws-credential.yml
++
++- name: create a aws instace/s
++  ec2:
++    key_name: "{{ key_name }}"
++    region: us-east-1
++    instance_type: t2.small
++    image: "{{centos_ami_7_2}}"
++    group: "{{ security_group }}"
++    instance_tags:
++      Name: "{{ item }}"
++    assign_public_ip: yes
++    state: present
++    count: 1
++    vpc_subnet_id: subnet-54f8f70c
++    volumes:
++      - device_name: /dev/sda1
++        volume_type: io1
++        iops: 200
++        volume_size: 50
++        delete_on_termination: true
++    wait: yes
++  with_items:
++    - Mesos-master-1
++    - Mesos-master-2
++    - Mesos-master-3
++    - Mesos-slave-1
++  register: ec2

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/ec2/vars/aws-credential.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/ec2/vars/aws-credential.yml
index 0000000,0000000..2e4c703
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/ec2/vars/aws-credential.yml
@@@ -1,0 -1,0 +1,3 @@@
++---
++aws_access_key: xxxxxxxxx 
++aws_secret_key: xxxxxxxxx

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/ec2/vars/main.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/ec2/vars/main.yml
index 0000000,0000000..1f7d77a
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/ec2/vars/main.yml
@@@ -1,0 -1,0 +1,8 @@@
++---
++
++key_name: shameera
++ec2_name: Mesos28
++centos_ami_7_2: ami-6d1c2007
++ubutntu_ami_16_04: ami-29f96d3e
++
++security_group: Mesos-sec

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/java/tasks/main.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/java/tasks/main.yml
index 0000000,0000000..92f2039
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/java/tasks/main.yml
@@@ -1,0 -1,0 +1,21 @@@
++---
++# Install Orcal Java
++- name: download oracle java 8 rpm
++  get_url: url="{{ java_rpm_url }}" dest="{{ java_dir_source }}" headers='Cookie:oraclelicense=accept-securebackup-cookie'
++  become: yes
++
++- name: Install oracle java 8
++  yum: name="{{ java_dir_source }}/{{ java_rpm_filename }}" state=present
++  become: yes
++
++- name: set Oracle Java {{ java_version_string }} as default
++  alternatives:
++    name="{{ item.exe }}"
++    link="/usr/bin/{{ item.exe }}"
++    path="{{ item.path }}/{{ item.exe }}"
++  with_items:
++    - { path: "{{ java_home }}/jre/bin", exe: 'java' }
++    - { path: "{{ java_home }}/jre/bin", exe: 'keytool' }
++    - { path: "{{ java_home }}/bin", exe: 'javac' }
++    - { path: "{{ java_home }}/bin", exe: 'javadoc' }
++  become: yes

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/java/vars/main.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/java/vars/main.yml
index 0000000,0000000..a995684
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/java/vars/main.yml
@@@ -1,0 -1,0 +1,15 @@@
++---
++#Variables associated with this role
++# Oracle Java 8
++java_dir_source: "/usr/local/src"
++
++java_version: 8
++java_version_update: 91
++java_version_build: '14'
++java_version_string: "1.{{ java_version }}.0_{{ java_version_update }}"
++java_home: "/usr/java/jdk1.{{ java_version }}.0_{{ java_version_update }}"
++
++java_rpm_filename: "jdk-{{ java_version }}u{{ java_version_update }}-linux-x64.rpm"
++java_rpm_url: "http://download.oracle.com/otn-pub/java/jdk/{{ java_version }}u{{ java_version_update
}}-b{{ java_version_build }}/{{ java_rpm_filename }}"
++
++...

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/mesos-master/tasks/backup_main.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/mesos-master/tasks/backup_main.yml
index 0000000,0000000..1d0abd1
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/mesos-master/tasks/backup_main.yml
@@@ -1,0 -1,0 +1,117 @@@
++---
++
++- name: wait untill instance is up and running
++  local_action: wait_for port=22
++                host="{{ ansible_ssh_host | default(inventory_hostname) }}"
++                search_regex=OpenSSH delay=10
++- name: create group
++  group: name="{{group}}"
++  become: yes
++
++- name: create user
++  user: name="{{user}}"
++  become: yes
++
++# RedHat related things
++- name: install required packages
++  yum: name="{{item}}" state=latest
++  with_items:
++    - wget
++    - tar
++    - git
++    - epel-release
++    - firewalld
++  become: yes
++
++- name: updage systemd
++  yum: name=systemd state=latest
++  become: yes
++
++- name: get apache maven
++  get_url:
++    url: http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo
++    dest: /etc/yum.repos.d/epel-apache-maven.repo
++  become: yes
++
++- name: copy svn repo file
++  copy:
++    src: wandisco-svn.repo
++    dest: /etc/yum.repos.d/wandisco-svn.repo
++  become: yes
++
++- name: install development tools
++  yum: name="@Development tools" state=present
++  become: yes
++
++#Install other Mesos dependencies.
++- name: install mesos dependencies
++  yum: name="{{item}}" state=latest
++  with_items:
++    - apache-maven
++    - python-devel
++    - java-1.8.0-openjdk-devel
++    - zlib-devel
++    - libcurl-devel
++    - openssl-devel
++    - cyrus-sasl-devel
++    - cyrus-sasl-md5
++    - apr-devel
++    - apr-util-devel
++    - subversion-devel
++  become: yes
++
++- name: start firewall service
++  service: name=firewalld state=started enabled=yes
++  become: yes
++
++- name: download and unarchive mesos latest
++  unarchive:
++      src="{{mesos_url}}"
++      dest="{{user_home}}"
++      remote_src=yes
++      copy=no
++      creates="{{mesos_deploy_dir}}/configure"
++      owner="{{user}}"
++      group="{{group}}"
++
++  # Bootstrap (Only required if building from git repository).
++  # $ ./bootstrap
++
++- name: make build dir
++  file: path="{{mesos_build_dir}}" state=directory owner={{user}} group={{group}}
++
++# - name: create simlink to configure script
++#   file: src="{{mesos_deploy_dir}}/configure"
++#         dest="{{mesos_build_dir}}/configure"
++#         state=link
++#         owner={{user}}
++#         group={{group}}
++#   tags: test
++
++- name: configure and build mesos
++  command: ../configure  chdir="{{mesos_build_dir}}"
++  register: build
++
++- name: run make
++  command: make chdir="{{mesos_build_dir}}"
++  when: build|success
++  register: make
++
++# - name: run make tests
++#   command: make check chdir="{{mesos_build_dir}}"
++#   when: make|success
++
++- name: open firewall port
++  firewalld: port=5050/tcp zone=public permanent=true state=enabled immediate=yes
++  become: yes
++
++- name: create working dir
++  file: path="{{mesos_work_dir}}" state=directory user={{user}} group={{group}}
++
++- name: start mesos master
++  command: ./bin/mesos-master.sh --ip={{inventory_hostname}} --work_dir={{mesos_work_dir}}
&
++      chdir={{mesos_build_dir}}
++
++- name: start mesos agent
++  command: /bin/mesos-agent.sh --master={{inventory_hostname}}:5050 --work_dir={{mesos_work_dir}}
&
++      chdir={{mesos_build_dir}}

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/mesos-master/tasks/main.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/mesos-master/tasks/main.yml
index 0000000,0000000..effb35a
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/mesos-master/tasks/main.yml
@@@ -1,0 -1,0 +1,86 @@@
++---
++# reference: https://open.mesosphere.com/getting-started/install/
++- name: install firewalld
++  yum:
++    name: firewalld
++    state: latest
++  become: yes
++
++- name: start firewalld
++  service:
++    name: firewalld
++    state: started
++    enabled: yes
++  become: yes
++
++- name: open ports
++  firewalld:
++    port: "{{ item }}"
++    zone: public
++    permanent: true
++    state: enabled
++    immediate: yes
++  with_items:
++    - "5050/tcp"
++    - "8080/tcp"
++  become: yes
++
++- name: install utility - TODO delete this
++  yum:
++    name: "{{ item }}"
++    state: latest
++  with_items:
++    - vim
++  become: yes
++
++# Setup repository
++- name: add mesosphere rpm
++  yum:
++    name: http://repos.mesosphere.com/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
++    state: present
++  become: yes
++
++- name: install mesos and marathon
++  yum:
++    name: "{{ item }}"
++    state: latest
++  with_items:
++    - mesos
++    - marathon
++    # - mesosphere-zookeeper
++  become: yes
++
++# configurations
++
++- name: set zk file for mesos master and marathon
++  template:
++    src: zk.j2
++    dest: /etc/mesos/zk
++    force: yes
++  become: yes
++
++- name: set zookeeper quorum
++  template:
++    src: quorum.j2
++    dest: /etc/mesos-master/quorum
++    force: yes
++  become: yes
++
++- name: stop and disable mesos slave
++  service:
++    name: mesos-slave
++    enabled: no
++    state: stopped
++  become: yes
++
++- name: restart mesos master
++  service:
++    name: mesos-master
++    state: restarted
++  become: yes
++
++- name: restart marathon
++  service:
++    name: marathon
++    state: restarted
++  become: yes

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/mesos-master/templates/quorum.j2
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/mesos-master/templates/quorum.j2
index 0000000,0000000..c1d54ef
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/mesos-master/templates/quorum.j2
@@@ -1,0 -1,0 +1,1 @@@
++{{zk_quorum}}

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/mesos-master/templates/zk.j2
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/mesos-master/templates/zk.j2
index 0000000,0000000..e82fe65
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/mesos-master/templates/zk.j2
@@@ -1,0 -1,0 +1,1 @@@
++zk://{{zk_1}}:{{zookeeper_client_port}},{{zk_2}}:{{zookeeper_client_port}},{{zk_3}}:{{zookeeper_client_port}}/mesos

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/mesos-slave/tasks/main.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/mesos-slave/tasks/main.yml
index 0000000,0000000..f6890fe
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/mesos-slave/tasks/main.yml
@@@ -1,0 -1,0 +1,66 @@@
++---
++- name: install firewalld
++  yum:
++    name: firewalld
++    state: latest
++    update_cache: yes
++  become: yes
++
++- name: start firewalld
++  service:
++    name: firewalld
++    state: started
++    enabled: yes
++  become: yes
++
++- name: open ports
++  firewalld:
++    port: "{{ item }}"
++    zone: public
++    permanent: true
++    state: enabled
++    immediate: yes
++  with_items:
++    - "5051/tcp"
++  become: yes
++
++# setup mesos slave
++- name: add mesosphere rpm
++  yum:
++    name: http://repos.mesosphere.com/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
++    state: present
++  become: yes
++
++- name: install mesos
++  yum:
++    name: mesos
++    state: latest
++  become: yes
++
++# zookeeper will be pulled in and isntall as a depencency automatically
++# - name: disable zookeeper
++#   service:
++#     name: mesosphere-zookeeper
++#     state: stopped
++#     enabled: no
++#   become: yes
++
++- name: set zk file for mesos master and marathon
++  template:
++    src: zk.j2
++    dest: /etc/mesos/zk
++    force: yes
++  become: yes
++
++- name: disable mesos-master
++  service:
++    name: mesos-master
++    state: stopped
++    enabled: no
++  become: yes
++
++- name: restart mesos slave
++  service:
++    name: mesos-slave
++    state: restarted
++  become: yes

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/mesos-slave/templates/zk.j2
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/mesos-slave/templates/zk.j2
index 0000000,0000000..e82fe65
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/mesos-slave/templates/zk.j2
@@@ -1,0 -1,0 +1,1 @@@
++zk://{{zk_1}}:{{zookeeper_client_port}},{{zk_2}}:{{zookeeper_client_port}},{{zk_3}}:{{zookeeper_client_port}}/mesos

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/test/tasks/main.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/test/tasks/main.yml
index 0000000,0000000..f0548b1
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/test/tasks/main.yml
@@@ -1,0 -1,0 +1,3 @@@
++- debug: msg="ding {{ inventory_hostname }}"
++
++- debug: msg="{{ inventory }}"

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/zookeeper/handlers/main.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/zookeeper/handlers/main.yml
index 0000000,0000000..f1ea4be
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/zookeeper/handlers/main.yml
@@@ -1,0 -1,0 +1,15 @@@
++---
++- name: start zookeeper
++  command: bin/zkServer.sh start
++  args:
++    chdir: "{{zookeeper_dir}}"
++
++- name: restart zookeeper
++  command: bin/zkServer.sh restart
++  args:
++    chdir: "{{zookeeper_dir}}"
++
++- name: stop zookeeper
++  command: bin/zkServer.sh stop
++  args:
++    chdir: "{{zookeeper_dir}}"

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/zookeeper/tasks/main.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/zookeeper/tasks/main.yml
index 0000000,0000000..02c246f
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/zookeeper/tasks/main.yml
@@@ -1,0 -1,0 +1,98 @@@
++---
++- name: install pre-requities
++  yum:
++    name: "{{item}}"
++    state: latest
++  with_items:
++    - firewalld
++    - vim
++  become: yes
++
++- name: start firewalld
++  service:
++    name: firewalld
++    state: started
++  become: yes
++
++- name: open zookeeper port
++  firewalld:
++    port: "{{item}}"
++    zone: public
++    permanent: true
++    state: enabled
++    immediate: yes
++  with_items:
++    - "{{zookeeper_client_port}}/tcp"
++    - 2888/tcp
++    - 3888/tcp
++  become: yes
++
++# - name: get ip4 address
++#   command: hostname -i
++#   register: _ip4
++#   tags: ttt
++
++# - debug:
++#     msg: "{{_ip4.stdout}}"
++#   tags: ttt
++
++######################
++- name: Download and unarchive zookeeper
++  unarchive:
++    src: "{{ zookeeper_url }}"
++    dest: /opt
++    copy: no
++    creates: /opt/zookeeper-{{ zookeeper_version }}
++    owner: "{{ user }}"
++    group: "{{ group }}"
++  become: yes
++
++- name: Link to Zookeeper Directory
++  file:
++    src: "/opt/zookeeper-{{ zookeeper_version }}"
++    dest: "{{zookeeper_dir}}"
++    state: link
++    force: yes
++  become: yes
++
++- name: Create Zookeeper Log Dir
++  file:
++    path: "{{zookeeper_log_dir}}"
++    owner: "{{ user }}"
++    group: "{{ group }}"
++    recurse: yes
++    state: directory
++    mode: 0644
++  become: yes
++
++- name: Create Zookeeper DataStore Dir
++  file:
++    path: "{{zookeeper_datastore_dir}}"
++    owner: "{{ user }}"
++    group: "{{ group }}"
++    recurse: yes
++    state: directory
++    mode: 0755
++  become: yes
++
++- name: Copy zoo.cfg file
++  template:
++    src: zoo.cfg.j2
++    # dest: "{{zookeeper_conf_dir}}/zoo.cfg"
++    dest: "{{zookeeper_dir}}/conf/zoo.cfg"
++    owner: "{{ user }}"
++    group: "{{ group }}"
++    mode: "u=rw,g=r,o=r"
++  notify:
++    - restart zookeeper
++
++
++- name: Copy myid file
++  template:
++    src: myid.j2
++    dest: "{{zookeeper_datastore_dir}}/myid"
++    owner: "{{ user }}"
++    group: "{{ group }}"
++    mode: "u=rw,g=r,o=r"
++  notify:
++    - restart zookeeper

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/zookeeper/templates/myid.j2
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/zookeeper/templates/myid.j2
index 0000000,0000000..78a0bd7
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/zookeeper/templates/myid.j2
@@@ -1,0 -1,0 +1,1 @@@
++{{ my_id }}

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/zookeeper/templates/zoo.cfg.j2
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/zookeeper/templates/zoo.cfg.j2
index 0000000,0000000..4845a71
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/zookeeper/templates/zoo.cfg.j2
@@@ -1,0 -1,0 +1,32 @@@
++# Licensed to the Apache Software Foundation (ASF) under one or more
++# contributor license agreements.  See the NOTICE file distributed with
++# this work for additional information regarding copyright ownership.
++# The ASF licenses this file to You under the Apache License, Version 2.0
++# (the "License"); you may not use this file except in compliance with
++# the License.  You may obtain a copy of the License at
++#
++#     http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++maxClientCnxns=50
++# The number of milliseconds of each tick
++tickTime=2000
++# The number of ticks that the initial
++# synchronization phase can take
++initLimit=10
++# The number of ticks that can pass between
++# sending a request and getting an acknowledgement
++syncLimit=5
++# the directory where the snapshot is stored.
++dataDir={{zookeeper_datastore_dir}}
++# the port at which the clients will connect
++clientPort={{zookeeper_client_port}}
++
++{% for server in zookeeper_servers %}
++server.{{ server.id }}={{ server.ip }}:2888:3888
++{% endfor %}

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/roles/zookeeper/vars/main.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/roles/zookeeper/vars/main.yml
index 0000000,0000000..07f9ca1
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/roles/zookeeper/vars/main.yml
@@@ -1,0 -1,0 +1,15 @@@
++---
++zookeeper_version: 3.4.8
++#zookeeper_conf_dir: /etc/zookeeper/conf
++zookeeper_log_dir: /var/log/zookeeper
++zookeeper_datastore_dir: /var/lib/zookeeper
++zookeeper_url: http://www.us.apache.org/dist/zookeeper/zookeeper-{{zookeeper_version}}/zookeeper-{{zookeeper_version}}.tar.gz
++zookeeper_dir: /opt/zookeeper
++#zookeeper_client_port: 2181
++
++zookeeper_servers:
++  - {id: "1", ip: "172.31.24.149"}
++  - {id: "2", ip: "172.31.19.49"}
++  - {id: "3", ip: "172.31.25.80"}
++#exhibitor_version: 1.5.5
++#exhibitor_install_dir: /opt/exhibitor

http://git-wip-us.apache.org/repos/asf/airavata/blob/7071ef17/modules/cloud/ansible-playbooks/site.yml
----------------------------------------------------------------------
diff --cc modules/cloud/ansible-playbooks/site.yml
index 0000000,0000000..17258bd
new file mode 100644
--- /dev/null
+++ b/modules/cloud/ansible-playbooks/site.yml
@@@ -1,0 -1,0 +1,19 @@@
++---
++- hosts: localhost
++  tags: ec2
++  roles:
++    - ec2
++
++- hosts: mesos-master
++  tags: mesos, mesos-master
++  roles:
++    - java
++    - zookeeper
++    - mesos-master
++
++- hosts: mesos-slave
++  tags: mesos, mesos-slave
++  roles:
++    - mesos-slave
++
++...


Mime
View raw message