Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
au_otree
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ansible
au_otree
Commits
0eee2857
Commit
0eee2857
authored
2 years ago
by
Torsten Nielsen
Browse files
Options
Downloads
Patches
Plain Diff
Install PostgreSQL create db and user
parent
77eff598
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+6
-0
6 additions, 0 deletions
README.md
defaults/main.yml
+1
-1
1 addition, 1 deletion
defaults/main.yml
tasks/postgresql_otree.yml
+24
-0
24 additions, 0 deletions
tasks/postgresql_otree.yml
with
31 additions
and
1 deletion
README.md
+
6
−
0
View file @
0eee2857
...
@@ -38,6 +38,12 @@ Add the collections: "community.general" (for capabilities) and "ansible.posix"
...
@@ -38,6 +38,12 @@ Add the collections: "community.general" (for capabilities) and "ansible.posix"
`$ ansible-galaxy collection install ansible.posix community.general`
`$ ansible-galaxy collection install ansible.posix community.general`
For the PostgreSQL part also install the collection and role
`$ ansible-galaxy collection install community.postgresql`
`$ ansible-galaxy install galaxyproject.postgresql`
Example Playbook
Example Playbook
----------------
----------------
...
...
This diff is collapsed.
Click to expand it.
defaults/main.yml
+
1
−
1
View file @
0eee2857
---
# defaults
---
# defaults
# user-account and server, where oTree is deployed
# user-account and server, where oTree is deployed
otree_user
:
"
ot"
otree_user
:
"
ot"
# DNS
# DNS
ansible-galaxy collections install ansible.posix community.general
otree_fqdn
:
"
otree.local"
otree_fqdn
:
"
otree.local"
# Where is the oTree code deployed from
# Where is the oTree code deployed from
otree_repo
:
"
https://gitlab.au.dk/otree/otree_example_apps.git"
otree_repo
:
"
https://gitlab.au.dk/otree/otree_example_apps.git"
...
...
This diff is collapsed.
Click to expand it.
tasks/postgresql_otree.yml
+
24
−
0
View file @
0eee2857
---
# PostgreSQL for oTree
---
# PostgreSQL for oTree
-
name
:
Which psycopg2 package
ansible.builtin.debug
:
msg
:
"
python{{
(ansible_python.version.major
==
3)
|
ternary('3',
'')
}}-psycopg2"
-
name
:
Install psycopg2
apt
:
name
:
"
python{{
(ansible_python.version.major
==
3)
|
ternary('3',
'')
}}-psycopg2"
# Install PostgreSQL
# Install PostgreSQL
-
name
:
Run the task from the galaxyproject.postgresql role to install PostgreSQL
-
name
:
Run the task from the galaxyproject.postgresql role to install PostgreSQL
ansible.builtin.include_role
:
ansible.builtin.include_role
:
name
:
galaxyproject.postgresql
name
:
galaxyproject.postgresql
vars
:
postgresql_install_psycopg2
:
true
# Create PostgreSQL db
-
name
:
"
Create
a
new
database
with
name
{{
otree_user
}}"
community.postgresql.postgresql_db
:
name
:
"
{{
otree_user
}}"
become
:
true
become_user
:
postgres
# Create PostgreSQL db-user
-
name
:
"
Connect
to
oTree
database
{{
otree_user
}},
create
oTree
user
{{
otree_user
}}"
community.postgresql.postgresql_user
:
db
:
"
{{
otree_user
}}"
name
:
"
{{
otree_user
}}"
password
:
christmas_tree_o
become
:
true
become_user
:
postgres
...
...
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment