Skip to content

Commit

Permalink
Dynamically looping.
Browse files Browse the repository at this point in the history
  • Loading branch information
enxebre committed Jul 17, 2015
1 parent 1099c52 commit bdb07c7
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 44 deletions.
6 changes: 4 additions & 2 deletions roles/frameworks/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# defaults file for frameworks
frameworks_dcos_cli_image: capgemini/dcos-cli
frameworks_zk_master_peers: "zk://{{ zookeeper_peers_nodes }}/mesos"
frameworks_mesos_master_url: "http://{{ ansible_ssh_host }}:5050"
frameworks_marathon_url: "http://{{ ansible_ssh_host }}:8080"
frameworks_mesos_master_url: "http://{{ ansible_ssh_host }}:{{ mesos_master_port }}"
frameworks_marathon_url: "http://{{ ansible_ssh_host }}:{{ marathon_port }}"

frameworks_cassandra_enabled: false
frameworks_cassandra_node_count: 1
frameworks_list:
- cassandra
40 changes: 0 additions & 40 deletions roles/frameworks/tasks/cassandra.yml

This file was deleted.

48 changes: 47 additions & 1 deletion roles/frameworks/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
---
# tasks file for frameworks
- include: cassandra.yml
- name: "create config directory"
when: "frameworks_{{ item }}_enabled"
run_once: true
template:
src: "{{ item }}-config.j2"
dest: "/tmp/{{ item }}-config"
mode: 0755
sudo: yes
tags:
- "{{ item }}"
with_items:
- "{{ frameworks_list }}"

- name: "install dcos-cli package"
when: "frameworks_{{ item }}_enabled"
run_once: true
docker:
name: "{{ item }}"
image: "{{ frameworks_dcos_cli_image }}"
state: started
command: "package install --options=/config --yes {{ item }}"
volumes:
- "/tmp/{{ item }}-config:/config"
env:
MESOS_MASTER_URL: "{{ frameworks_mesos_master_url }}"
MARATHON_URL: "{{ frameworks_marathon_url }}"
tags:
- "{{ item }}"
with_items:
- "{{ frameworks_list }}"

- name: "uninstall dcos-cli package"
when: "not frameworks_{{ item }}_enabled"
run_once: true
docker:
name: "{{ item }}"
image: "{{ frameworks_dcos_cli_image }}"
state: started
command: "package uninstall {{ item }}"
env:
MESOS_MASTER_URL: "{{ frameworks_mesos_master_url }}"
MARATHON_URL: "{{ frameworks_marathon_url }}"
tags:
- "{{ item }}"
with_items:
- "{{ frameworks_list }}"

2 changes: 1 addition & 1 deletion roles/frameworks/templates/cassandra-config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"mesos": {"master": "{{ frameworks_zk_master_peers }}"},
"cassandra": {
"zk": "zk://{{ zookeeper_peers_nodes }}/cassandra-mesos",
"node-count": "{{ frameworks_cassandra_node_count }}"
"node-count": {{ frameworks_cassandra_node_count }}
}
}
1 change: 1 addition & 0 deletions roles/mesos/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ mesos_resources: "ports(*):[31000-32000]"
mesos_slave_work_dir: "/tmp/mesos"
mesos_ip: "{{ ansible_default_ipv4.address }}"
mesos_hostname: "{{ ansible_ssh_host }}"

0 comments on commit bdb07c7

Please sign in to comment.