From 9ca0869eacf4ee2d13b170e23b135bbe42f31fff Mon Sep 17 00:00:00 2001 From: Michael Hamrah Date: Sun, 2 Nov 2014 12:04:25 -0500 Subject: [PATCH] reorganizing --- Ansiblefile.lock | 14 +++++++++++--- common.yml | 33 ++++++++++++++++++++++++++++++++ hosts.sample | 2 +- mesos_primaries.yml | 21 +++++++++++++++++++++ mesos_workers.yml | 12 ++++++++++++ playbook.yml | 46 ++++----------------------------------------- 6 files changed, 82 insertions(+), 46 deletions(-) create mode 100644 common.yml create mode 100644 mesos_primaries.yml create mode 100644 mesos_workers.yml diff --git a/Ansiblefile.lock b/Ansiblefile.lock index 425840f..5b075e7 100644 --- a/Ansiblefile.lock +++ b/Ansiblefile.lock @@ -15,28 +15,36 @@ GIT GIT remote: https://github.com/mhamrah/ansible-marathon ref: master - sha: 97561fc9b9afb4f95a3541e66d61145c0ec2d903 + sha: c8b9dde6ce543df6bb61f890a74c49cc688bc944 specs: ansible-marathon (0.0.0) GIT remote: https://github.com/mhamrah/ansible-mesos ref: master - sha: f1fb0e20412c614acf8a281821ecfdb2da6aa12c + sha: d9b67e65e76914d7b53734690b86cd90118d767d specs: ansible-mesos (0.0.0) GIT remote: https://github.com/mhamrah/ansible-zookeeper ref: master - sha: 142a6fc388fc721da1ec741e52d86f2e870ded2a + sha: ba4340361486b58f13d7581e9a0ba87c11ec4b49 specs: ansible-zookeeper (0.0.0) +GIT + remote: https://github.com/tmtk75/ansible-consul + ref: master + sha: 8658962cbd788083ec8ea45715a7408f32bfb5d9 + specs: + tmtk75.consul (0.0.0) + DEPENDENCIES ansible-docker (>= 0) ansible-java8 (>= 0) ansible-marathon (>= 0) ansible-mesos (>= 0) ansible-zookeeper (>= 0) + tmtk75.consul (>= 0) diff --git a/common.yml b/common.yml new file mode 100644 index 0000000..4733e80 --- /dev/null +++ b/common.yml @@ -0,0 +1,33 @@ +--- +- hosts: [all] + sudo: True + tags: ['system'] + pre_tasks: + - name: Install Debian Packages + apt: pkg={{ item }} state=present + with_items: + - git + - vim + - htop + - unzip + when: ansible_os_family == "Debian" + - name: Downloading and enable the EPEL repository definitions. + yum: name=http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm state=present + when: ansible_os_family == "RedHat" + - name: Install Redhat Packages + yum: pkg={{ item }} state=present + with_items: + - java7 + - git + - vim + - htop + - unzip + when: ansible_os_family == "RedHat" + - name: Disable iptables + action: service name=iptables state=stopped enabled=false + when: ansible_os_family == "RedHat" + - name: Remove require tty + lineinfile: regexp="requiretty" dest=/etc/sudoers state=absent + - name: Remove require tty - alt + lineinfile: regexp="requiretty" dest=/etc/sudoers/os_defaults state=absent + diff --git a/hosts.sample b/hosts.sample index 6aeea80..6261f7c 100644 --- a/hosts.sample +++ b/hosts.sample @@ -1,5 +1,5 @@ [mesos_masters] -ec2-54-204-214-172.compute-1.amazonaws.com zoo_id=1 +ec2-54-204-214-172.compute-1.amazonaws.com zoo_id=1 consul_bootstrap=true ec2-54-235-59-210.compute-1.amazonaws.com zoo_id=2 ec2-54-83-161-83.compute-1.amazonaws.com zoo_id=3 diff --git a/mesos_primaries.yml b/mesos_primaries.yml new file mode 100644 index 0000000..3f04511 --- /dev/null +++ b/mesos_primaries.yml @@ -0,0 +1,21 @@ +--- +- hosts: [mesos_primaries] + sudo: True + pre_tasks: + - name: Install HAProxy (RedHat) + yum: pkg=haproxy state=present + when: ansible_os_family == "RedHat" + - name: Install HAProxy (Ubuntu) + apt: pkg=haproxy state=present + when: ansible_os_family == "Debian" + - name: Sets haproxy to enabled (Ubuntu) + lineinfile: dest=/etc/default/haproxy regexp="^ENABLED" line="ENABLED=1" + when: ansible_os_family == "Debian" + roles: + - { role: 'ansible-java8', tags:['runtimes', 'java'], when: ansible_os_family == 'Debian' } + - { role: 'ansible-zookeeper', zookeeper_hosts: "{{ groups.mesos_primaries}}", tags:['zookeeper'] } + - { role: 'ansible-mesos', mesos_quorum: "2", zookeeper_hostnames: "{{ groups.mesos_primaries | join(':' + zookeeper_client_port + ',') }}:{{ zookeeper_client_port }}", mesos_install_mode: 'master', mesos_cluster_name: 'mlh_mesos', tags: ['mesos', 'platforms'] } + - { role: 'ansible-marathon', zookeeper_hostnames: "{{ groups.mesos_primaries | join(':' + zookeeper_client_port + ',') }}:{{ zookeeper_client_port }}", tags:['mesos-tools'] } + - { role: 'ansible-consul', consul_client_address: "0.0.0.0", consul_version: "0.4.1", consul_datacenter: "sea", consul_is_server: true, consul_servers: "{{ groups.mesos_primaries }}", consul_is_ui: true, consul_join_at_start: true } + + diff --git a/mesos_workers.yml b/mesos_workers.yml new file mode 100644 index 0000000..82c0e91 --- /dev/null +++ b/mesos_workers.yml @@ -0,0 +1,12 @@ +--- +- hosts: [mesos_workers] + sudo: True + pre_tasks: + - name: Remove require tty + lineinfile: regexp="tty" dest=/etc/sudoers/os_defaults state=absent + tags: ['system'] + roles: + - { role: 'ansible-docker', tags:['docker'] } + - { role: 'ansible-java8', tags:['java'], when: ansible_os_family == 'Debian' } + - { role: 'ansible-mesos', mesos_containerizers: "docker,mesos", zookeeper_hostnames: "{{ groups.mesos_primaries | join(':' + zookeeper_client_port + ',') }}:{{ zookeeper_client_port }}", mesos_install_mode: "slave", tags: ['mesos'] } + - { role: 'ansible-consul', consul_client_address: "0.0.0.0", consul_is_server: false, consul_datacenter: "sea", consul_servers: "{{ groups.mesos_primaries }}", consul_join_at_start: true, tags:['consul'] } diff --git a/playbook.yml b/playbook.yml index 3e6ba54..c1d8fd2 100644 --- a/playbook.yml +++ b/playbook.yml @@ -1,42 +1,4 @@ -- hosts: [mesos_masters] - sudo: True - pre_tasks: - - name: Install Debian Packages - apt: pkg={{ item }} state=present - with_items: - - git - - vim - - htop - - haproxy - when: ansible_os_family == "Debian" - - name: Downloading and enable the EPEL repository definitions. - action: command rpm -Uvh --replacepkgs http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm - when: ansible_os_family == "RedHat" - - name: Install Redhat Packages - yum: pkg={{ item }} state=present - with_items: - - java7 - - git - - vim - - htop - - haproxy - when: ansible_os_family == "RedHat" - - name: Disable iptables - action: service name=iptables state=stopped enabled=false - when: ansible_os_family == "RedHat" - - name: Sets haproxy to enabled - lineinfile: dest=/etc/default/haproxy regexp="^ENABLED" line="ENABLED=1" - when: ansible_os_family == "Debian" - - roles: - - { role: 'ansible-java8', tags:['runtimes', 'java'], when: ansible_os_family == 'Debian' } - - { role: 'ansible-zookeeper', zookeeper_hosts: "{{ groups.mesos_masters}}", tags:['zookeeper'] } - - { role: 'ansible-mesos', mesos_quorum: "2", zookeeper_hostnames: "{{ groups.mesos_masters | join(':' + zookeeper_client_port + ',') }}:{{ zookeeper_client_port }}", mesos_install_mode: 'master', mesos_cluster_name: 'mlh_mesos', tags: ['mesos', 'platforms'] } - - { role: 'ansible-marathon', zookeeper_hostnames: "{{ groups.mesos_masters | join(':' + zookeeper_client_port + ',') }}:{{ zookeeper_client_port }}", tags:['mesos-tools'] } - -- hosts: [mesos_slaves] - sudo: True - roles: - - { role: 'ansible-docker', tags:['runtimes', 'docker'] } - - { role: 'ansible-java8', tags:['runtimes', 'java'], when: ansible_os_family == 'Debian' } - - { role: 'ansible-mesos', mesos_containerizers: "docker,mesos", zookeeper_hostnames: "{{ groups.mesos_masters | join(':' + zookeeper_client_port + ',') }}:{{ zookeeper_client_port }}", mesos_install_mode: "slave", tags: ['mesos', 'platforms'] } +--- +- include: common.yml +- include: mesos_primaries.yml +- include: mesos_workers.yml