-
Notifications
You must be signed in to change notification settings - Fork 0
/
client-authentication
executable file
·41 lines (39 loc) · 1.39 KB
/
client-authentication
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env ansible-playbook
# (c) 2016 DataNexus Inc. All Rights Reserved.
#
# allow hosts on the same subnet
---
- name: discovering all {{ application }} nodes
vars_files:
- "{{ configuration }}"
- vars/postgresql.yml
hosts: localhost
tasks:
- ec2_instance_facts:
region: "{{ region }}"
filters:
instance-state-name: running
"tag:Application": "{{ application }}"
"tag:Domain": "{{ domain }}"
"tag:Project": "{{ project }}"
"tag:Tenant": "{{ tenant }}"
"tag:Cluster": "{{ cluster | default ('a') }}"
"tag:Role": "{{ role | default ('none') }}"
register: postgresql_instances
when:
- cloud == 'aws'
- name: building postgresql host group
add_host: hostname="{{ item }}" groupname=postgresql ansible_user="{{ user }}" ansible_ssh_private_key_file="./{{cloud }}-{{ region }}-{{ project }}-{{ application }}-private-key.pem"
with_items: "{{ postgresql_instances.instances | map (attribute='private_ip_address') | list }}"
when:
- cloud == 'aws'
- postgresql_instances is defined
- postgresql_instances.instances|length > 0
- name: updating {{ application }} connetion rules
hosts: "{{ application }}"
vars_files:
- "{{ configuration }}"
- vars/postgresql.yml
gather_facts: no
roles:
- { role: allow-private-external }