init
This commit is contained in:
commit
3ab58714d6
10 changed files with 160 additions and 0 deletions
8
ansible/ansible.cfg
Normal file
8
ansible/ansible.cfg
Normal file
|
@ -0,0 +1,8 @@
|
|||
[defaults]
|
||||
roles_path=~/.ansible/roles:roles:/usr/share/ansible/roles:/etc/ansible/roles
|
||||
inventory=inventory
|
||||
#vault_password_file=util/secret-service-client.sh
|
||||
interpreter_python=/usr/bin/python3
|
||||
|
||||
[diff]
|
||||
always = True
|
6
ansible/inventory/host_vars/thecloud.yml
Normal file
6
ansible/inventory/host_vars/thecloud.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
apt_install_packages:
|
||||
- postgresql
|
||||
- python3-psycopg2
|
||||
- nfs-kernel-server
|
||||
|
||||
nfs_exports: []
|
5
ansible/inventory/hosts.yml
Normal file
5
ansible/inventory/hosts.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
all:
|
||||
hosts:
|
||||
thecloud:
|
||||
ansible_user: root
|
||||
ansible_host: thecloud.dmz
|
6
ansible/requirements.yml
Normal file
6
ansible/requirements.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
- name: apt
|
||||
src: https://github.com/sunscrapers/ansible-role-apt.git
|
||||
scm: git
|
||||
- name: cloudinit_wait
|
||||
src: https://git.pim.kunis.nl/pim/ansible-role-cloudinit-wait
|
||||
scm: git
|
4
ansible/roles/postgresql/handlers/main.yml
Normal file
4
ansible/roles/postgresql/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: restart postgres
|
||||
systemd:
|
||||
name: postgresql
|
||||
state: restarted
|
15
ansible/roles/postgresql/tasks/main.yml
Normal file
15
ansible/roles/postgresql/tasks/main.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
- name: Open postgres port
|
||||
ini_file:
|
||||
path: /etc/postgresql/15/main/postgresql.conf
|
||||
section: null
|
||||
option: listen_addresses
|
||||
value: "'*'"
|
||||
notify: restart postgres
|
||||
|
||||
- name: Change data directory
|
||||
ini_file:
|
||||
path: /etc/postgresql/15/main/postgresql.conf
|
||||
section: null
|
||||
option: data_directory
|
||||
value: "'/mnt/data/postgresql'"
|
||||
notify: restart postgres
|
24
ansible/thecloud.yml
Normal file
24
ansible/thecloud.yml
Normal file
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
- name: Wait for Cloud-Init to finish
|
||||
hosts: all
|
||||
gather_facts: no
|
||||
roles:
|
||||
- cloudinit_wait
|
||||
|
||||
- name: Setup NFS
|
||||
hosts: thecloud
|
||||
|
||||
roles:
|
||||
- {role: apt, tags: apt}
|
||||
- {role: postgresql, tags: postgresql}
|
||||
|
||||
post_tasks:
|
||||
- name: Ensure NFS exports directory exists
|
||||
file:
|
||||
path: /etc/exports.d
|
||||
state: directory
|
||||
|
||||
- name: Start NFS
|
||||
systemd:
|
||||
name: nfs-kernel-server
|
||||
state: started
|
Reference in a new issue