Skip to content

Commit

Permalink
Copy templates to all machines
Browse files Browse the repository at this point in the history
  • Loading branch information
prabhuvigneshkumarrajagopal committed Oct 14, 2016
1 parent 604298d commit fe08a0b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 12 deletions.
35 changes: 35 additions & 0 deletions consul_playbook.yml
Expand Up @@ -5,6 +5,38 @@
- PrabhuVignesh.consul_installer


- hosts: bootstraping
sudo: yes

tasks:
- name: Placing configuration file into the consul.d
action: template src=template/consul.d/bootstrap.j2 dest=/etc/consul.d/bootstrap.json mode=0755

- name: creating script file
action: template src=template/scripts/agentrun.j2 dest=/tmp/agentrun.sh mode=0777

- hosts: servers
sudo: yes

tasks:
- name: Placing configuration file into the consul.d
action: template src=template/consul.d/server.j2 dest=/etc/consul.d/server.json mode=0755

- name: creating script file
action: template src=template/scripts/agentrun.j2 dest=/tmp/agentrun.sh mode=0777

- hosts: clients
sudo: yes

tasks:
- name: Placing configuration file into the consul.d
action: template src=template/consul.d/client.j2 dest=/etc/consul.d/client.json mode=0755

- name: creating script file
action: template src=template/scripts/agentrun.j2 dest=/tmp/agentrun.sh mode=0777




- hosts: dbservers
sudo: yes
Expand All @@ -16,6 +48,9 @@
- name: creating script file
action: template src=template/scripts/agentrun.j2 dest=/tmp/agentrun.sh mode=0777




- hosts: webservers
sudo: yes

Expand Down
7 changes: 3 additions & 4 deletions template/consul.d/bootstrap.j2
@@ -1,10 +1,9 @@
{
"bootstrap": true,
"server": false,
"datacenter": "nyc2",
"data_dir": "/var/consul",
"ui_dir": "/home/consul/dist",
"encrypt": "X4SYOinf2pTAcAHRhpj7dA==",
"data_dir": "/tmp/consul",
"log_level": "INFO",
"enable_syslog": true,
"start_join": {{ groups['dbservers'] }}
"start_join": {{ groups['bootstraping'] }}
}
7 changes: 3 additions & 4 deletions template/consul.d/client.j2
@@ -1,10 +1,9 @@
{
"server": false,
"datacenter": "nyc2",
"data_dir": "/var/consul",
"ui_dir": "/home/consul/dist",
"encrypt": "X4SYOinf2pTAcAHRhpj7dA==",
"data_dir": "/tmp/consul",
"ui_dir": "/tmp",
"log_level": "INFO",
"enable_syslog": true,
"start_join": ["192.0.2.1", "192.0.2.2", "192.0.2.3"]
"start_join": {{ groups['clients'] }}
}
7 changes: 3 additions & 4 deletions template/consul.d/server.j2
@@ -1,10 +1,9 @@
{
"bootstrap": false,
"server": false,
"datacenter": "nyc2",
"data_dir": "/var/consul",
"ui_dir": "/home/consul/dist",
"encrypt": "X4SYOinf2pTAcAHRhpj7dA==",
"data_dir": "/tmp/consul",
"log_level": "INFO",
"enable_syslog": true,
"start_join": ["192.0.2.1", "192.0.2.2", "192.0.2.3"]
"start_join": {{ groups['servers'] }}
}

0 comments on commit fe08a0b

Please sign in to comment.