Commit f920bd7e authored by Georgios Ouzounis's avatar Georgios Ouzounis
Browse files

LAM-53 Added the creation of Unix user, PostgreSQL user and PostgreSQL...

LAM-53 Added the creation of Unix user, PostgreSQL user and PostgreSQL database. Added variables for the username and the database name.
parent 2503a9be
---
- name: Download Django code from Github.
git: repo=https://github.com/gouzouni625/okeanos-LoD.git dest=/root/okeanos-LoD
--- ---
- name: Fix Debian locale error. - name: Fix Debian locale error.
shell: echo 'LANGUAGE="en_US.UTF-8"' > /etc/default/locale && echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale # The first redirection intentionally creates the file. command: update-locale LANGUAGE="en_US.UTF-8" LC_ALL="en_US.UTF-8" #"echo 'LANGUAGE="en_US.UTF-8"' > /etc/default/locale && echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale # The first redirection intentionally creates the file.
- name: Upgrade packages. - name: Upgrade packages.
apt: upgrade=dist update_cache=yes apt: upgrade=dist update_cache=yes
- name: Install python-pip package. - name: Install python-pip, python-dev, sudo and git packages.
apt: name=python-pip state=latest apt: name={{ item.name }} state=latest
with_items:
- { name: 'python-pip' }
- { name: 'python-dev' }
- { name: 'sudo' }
- { name: 'git' }
- name: Install python-dev package. - name: Create service user.
apt: name=python-dev state=latest user: name={{ username }} shell=/bin/bash
- name: Install git.
apt: name=git state=latest
- name: Include postgresql-install tasks. - name: Include postgresql-install tasks.
include: postgresql-install.yml include: postgresql-install.yml
...@@ -20,5 +22,7 @@ ...@@ -20,5 +22,7 @@
- name: Include django-install tasks. - name: Include django-install tasks.
include: django-install.yml include: django-install.yml
- name: Include github tasks. - name: Download Django code from Github.
include: github.yml git: repo=https://github.com/gouzouni625/okeanos-LoD.git dest={{ repository_download_path }}/okeanos-LoD version=LAM-53-Django # version can be used to select a branch. See ansible git module documentation.
notify: # The repository should be changed when the pull request gets merged.
- django_db_migrate
--- ---
- name: Install PosgreSQL. - name: Install PosgreSQL and libpq-dev packages.
apt: name=postgresql state=latest apt: name={{ item.name }} state=latest
with_items:
- name: Install libpq-dev. - { name: 'postgresql' }
apt: name=libpq-dev state=latest - { name: 'libpq-dev' }
- name: Install Python connector for PostgreSQL. - name: Install Python connector for PostgreSQL.
pip: name=psycopg2 pip: name=psycopg2
- name: Create PostgreSQL database for service user.
sudo_user: postgres
postgresql_db: name={{ database_name }}
- name: Create PostgreSQL role for lambdaservice user.
sudo_user: postgres
postgresql_user: db={{ database_name }} name={{ username }} password={{ database_user_password }}
---
username: lambda
database_name: lambda_service_db
database_user_password: change_me
repository_download_path: /home/{{ username }}/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment