forked from squad12-devops/case-study
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnsible_postgre.yml
More file actions
62 lines (62 loc) · 1.58 KB
/
Ansible_postgre.yml
File metadata and controls
62 lines (62 loc) · 1.58 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
-
become: true
hosts: localhost
tasks:
-
apt:
cache_valid_time: 86400
update_cache: true
upgrade: true
name: "ensure apt cache is up to date"
-
apt:
name: libpq-dev
state: present
name: "ensure packages are installed"
-
file:
mode: 511
path: /postgres/data
state: directory
name: "Create Folder1"
-
file:
mode: 511
path: /home/postgres/scripts
state: directory
name: "Create folder2"
-
apt:
name: postgresql
state: present
name: "install PostgreSQL"
-
apt:
name: postgresql-contrib
state: present
name: "install postgresql-contrib"
-
name: "Prepare update"
shell: "sed -i 's+localhost+*+gI' /etc/postgresql/10/main/postgresql.conf"
-
name: "Prepare update"
shell: "sed -i 's+#listen_addresses+listen_addresses+gI' /etc/postgresql/10/main/postgresql.conf"
-
pause: seconds=5
-
get_url: "url=https://raw.githubusercontent.com/devopsbc01/Scripts/master/initial-table.sql dest=/home/postgres/scripts"
name: "download table script"
-
name: "run script"
shell: "sudo -u postgres psql -f /home/postgres/scripts/initial-table.sql"
-
name: "restarting db"
shell: "sudo /etc/init.d/postgresql restart"
vars:
dfolder: /postgres/data
logfile: psqlinstall-log
rfolder: /postgres
scripts: /home/$USER/scripts
sqlscript: $scripts/initial-table.sql
sysuser: postgres