Add all files needed to bring up VM and run agaric.com locally
This commit is contained in:
parent
52c8b60bac
commit
4d2bc0ee24
742 changed files with 24037 additions and 0 deletions
box/provisioning/roles/geerlingguy.postgresql/tasks
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- name: Configure global settings.
|
||||
lineinfile:
|
||||
dest: "{{ postgresql_config_path }}/postgresql.conf"
|
||||
regexp: "^#?{{ item.option }}.+$"
|
||||
line: "{{ item.option }} = '{{ item.value }}'"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
with_items: "{{ postgresql_global_config_options }}"
|
||||
notify: restart postgresql
|
||||
|
||||
- name: Configure host based authentication (if entries are configured).
|
||||
template:
|
||||
src: "templates/pg_hba.conf.j2"
|
||||
dest: "{{ postgresql_config_path }}/pg_hba.conf"
|
||||
owner: "{{ postgresql_user }}"
|
||||
group: "{{ postgresql_group }}"
|
||||
mode: 0600
|
||||
notify: restart postgresql
|
||||
when: postgresql_hba_entries
|
||||
|
||||
- name: Ensure PostgreSQL unix socket dirs exist.
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ postgresql_user }}"
|
||||
group: "{{ postgresql_group }}"
|
||||
mode: 02775
|
||||
with_items: "{{ postgresql_unix_socket_directories }}"
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
- name: Ensure PostgreSQL databases are present.
|
||||
postgresql_db:
|
||||
name: "{{ item.name }}"
|
||||
lc_collate: "{{ item.lc_collate | default('en_US.UTF-8') }}"
|
||||
lc_ctype: "{{ item.lc_ctype | default('en_US.UTF-8') }}"
|
||||
encoding: "{{ item.encoding | default('UTF-8') }}"
|
||||
template: "{{ item.template | default('template0') }}"
|
||||
login_host: "{{ item.login_host | default('localhost') }}"
|
||||
login_password: "{{ item.login_password | default(omit) }}"
|
||||
login_user: "{{ item.login_user | default(postgresql_user) }}"
|
||||
login_unix_socket: "{{ item.login_unix_socket | default(postgresql_unix_socket_directories[0]) }}"
|
||||
port: "{{ item.port | default(omit) }}"
|
||||
owner: "{{ item.owner | default(postgresql_user) }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
with_items: "{{ postgresql_databases }}"
|
||||
become: yes
|
||||
become_user: "{{ postgresql_user }}"
|
||||
# See: https://github.com/ansible/ansible/issues/16048#issuecomment-229012509
|
||||
vars:
|
||||
ansible_ssh_pipelining: true
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- name: Set PostgreSQL environment variables.
|
||||
template:
|
||||
src: postgres.sh.j2
|
||||
dest: /etc/profile.d/postgres.sh
|
||||
mode: 0644
|
||||
notify: restart postgresql
|
||||
|
||||
- name: Ensure PostgreSQL data directory exists.
|
||||
file:
|
||||
path: "{{ postgresql_data_dir }}"
|
||||
owner: "{{ postgresql_user }}"
|
||||
group: "{{ postgresql_group }}"
|
||||
state: directory
|
||||
mode: 0700
|
||||
|
||||
- name: Check if PostgreSQL database is initialized.
|
||||
stat:
|
||||
path: "{{ postgresql_data_dir }}/PG_VERSION"
|
||||
register: pgdata_dir_version
|
||||
|
||||
- name: Ensure PostgreSQL database is initialized.
|
||||
command: "{{ postgresql_bin_path }}/initdb -D {{ postgresql_data_dir }}"
|
||||
when: not pgdata_dir_version.stat.exists
|
||||
become: yes
|
||||
become_user: "{{ postgresql_user }}"
|
||||
# See: https://github.com/ansible/ansible/issues/16048#issuecomment-229012509
|
||||
vars:
|
||||
ansible_ssh_pipelining: true
|
26
box/provisioning/roles/geerlingguy.postgresql/tasks/main.yml
Normal file
26
box/provisioning/roles/geerlingguy.postgresql/tasks/main.yml
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
# Variable configuration.
|
||||
- include: variables.yml
|
||||
static: no
|
||||
|
||||
# Setup/install tasks.
|
||||
- include: setup-RedHat.yml
|
||||
when: ansible_os_family == 'RedHat'
|
||||
static: no
|
||||
|
||||
- include: setup-Debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
static: no
|
||||
|
||||
- include: initialize.yml
|
||||
- include: configure.yml
|
||||
|
||||
- name: Ensure PostgreSQL is started and enabled on boot.
|
||||
service:
|
||||
name: "{{ postgresql_daemon }}"
|
||||
state: started
|
||||
enabled: yes
|
||||
|
||||
# Configure PostgreSQL.
|
||||
- include: databases.yml
|
||||
- include: users.yml
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
- name: Ensure PostgreSQL Python libraries are installed.
|
||||
apt:
|
||||
name: "{{ postgresql_python_library }}"
|
||||
state: installed
|
||||
|
||||
- name: Ensure PostgreSQL packages are installed.
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: installed
|
||||
with_items: "{{ postgresql_packages }}"
|
||||
|
||||
- name: Ensure all configured locales are present.
|
||||
locale_gen: "name={{ item }} state=present"
|
||||
with_items: "{{ postgresql_locales }}"
|
||||
register: locale_gen_result
|
||||
|
||||
- name: Force-restart PostgreSQL after new locales are generated.
|
||||
service:
|
||||
name: "{{ postgresql_daemon }}"
|
||||
state: restarted
|
||||
when: locale_gen_result.changed
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- name: Ensure PostgreSQL packages are installed.
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: installed
|
||||
enablerepo: "{{ postgresql_enablerepo }}"
|
||||
with_items: "{{ postgresql_packages }}"
|
||||
|
||||
- name: Ensure PostgreSQL Python libraries are installed.
|
||||
package:
|
||||
name: "{{ postgresql_python_library }}"
|
||||
state: installed
|
||||
enablerepo: "{{ postgresql_enablerepo }}"
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
- name: Ensure PostgreSQL users are present.
|
||||
postgresql_user:
|
||||
name: "{{ item.name }}"
|
||||
password: "{{ item.password | default(omit) }}"
|
||||
priv: "{{ item.priv | default(omit) }}"
|
||||
role_attr_flags: "{{ item.role_attr_flags | default(omit) }}"
|
||||
db: "{{ item.db | default(omit) }}"
|
||||
login_host: "{{ item.login_host | default('localhost') }}"
|
||||
login_password: "{{ item.login_password | default(omit) }}"
|
||||
login_user: "{{ item.login_user | default(postgresql_user) }}"
|
||||
login_unix_socket: "{{ item.login_unix_socket | default(postgresql_unix_socket_directories[0]) }}"
|
||||
port: "{{ item.port | default(omit) }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
with_items: "{{ postgresql_users }}"
|
||||
no_log: true
|
||||
become: yes
|
||||
become_user: "{{ postgresql_user }}"
|
||||
# See: https://github.com/ansible/ansible/issues/16048#issuecomment-229012509
|
||||
vars:
|
||||
ansible_ssh_pipelining: true
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
# Variable configuration.
|
||||
- name: Include OS-specific variables (Debian).
|
||||
include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Include OS-specific variables (RedHat).
|
||||
include_vars: "{{ ansible_os_family }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Define postgresql_packages.
|
||||
set_fact:
|
||||
postgresql_packages: "{{ __postgresql_packages | list }}"
|
||||
when: postgresql_packages is not defined
|
||||
|
||||
- name: Define postgresql_daemon.
|
||||
set_fact:
|
||||
postgresql_daemon: "{{ __postgresql_daemon }}"
|
||||
when: postgresql_daemon is not defined
|
||||
|
||||
- name: Define postgresql_version.
|
||||
set_fact:
|
||||
postgresql_version: "{{ __postgresql_version }}"
|
||||
when: postgresql_version is not defined
|
||||
|
||||
- name: Define postgresql_data_dir.
|
||||
set_fact:
|
||||
postgresql_data_dir: "{{ __postgresql_data_dir }}"
|
||||
when: postgresql_data_dir is not defined
|
||||
|
||||
- name: Define postgresql_bin_path.
|
||||
set_fact:
|
||||
postgresql_bin_path: "{{ __postgresql_bin_path }}"
|
||||
when: postgresql_bin_path is not defined
|
||||
|
||||
- name: Define postgresql_config_path.
|
||||
set_fact:
|
||||
postgresql_config_path: "{{ __postgresql_config_path }}"
|
||||
when: postgresql_config_path is not defined
|
Loading…
Add table
Add a link
Reference in a new issue