Skip to content

Commit 7f58eb3

Browse files
committed
Enhance flask role to update local /etc/hosts for appdb1 resolution
1 parent 2893dcb commit 7f58eb3

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

ansible.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[defaults]
2-
# inventory = hosts
2+
inventory = hosts
33
retry_files_enabled = false
44

55
stdout_callback = default

provision_app_tier.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
- name: Get database IP address with hostvars for app servers
2+
hosts: database_servers
3+
gather_facts: true
4+
tags:
5+
- application_servers
6+
7+
tasks: []
8+
19
- name: Deploy, configure, and populate flask repo and virtualenv
210
hosts: app_servers
311
become: true
4-
gather_facts: false
12+
gather_facts: true
513
tags:
614
- application_servers
715

roles/flask/tasks/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
---
2+
- name: Add appdb1 IP address to app servers /etc/hosts
3+
lineinfile:
4+
dest: /etc/hosts
5+
regexp: '.*appdb1$'
6+
line: "{{ hostvars['appdb1']['ansible_default_ipv4']['address'] }} appdb1"
7+
state: present
8+
29
- name: Create flask user
310
user:
411
name: "{{ flask_user }}"

smoke_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
- name: Check webserver for correct response
3838
uri:
39-
url: "http://frontend1.{{ GUID }}.example.opentlc.com/ping"
39+
url: "http://frontend1/ping"
4040
return_content: yes
4141
until: '"alive" in result.content'
4242
retries: 10

0 commit comments

Comments
 (0)