diff --git a/ansible/inventories/etica.dev/hosts.yml b/ansible/inventories/etica.dev/hosts.yml index 479b71e..e86e1d8 100644 --- a/ansible/inventories/etica.dev/hosts.yml +++ b/ansible/inventories/etica.dev/hosts.yml @@ -31,3 +31,7 @@ all: # Ubuntu 18.04, you can explicitly force the pip package and pip executable: pip_package: "python3-pip" pip_executable: "pip3" + + # @see https://github.com/geerlingguy/ansible-role-postgresql + # We're using python 3 on the host, but the default is python-psycopg2 + postgresql_python_library: python3-psycopg2 diff --git a/ansible/playbook.yml b/ansible/playbook.yml index 88f524b..b53b687 100644 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -11,3 +11,4 @@ - import_playbook: playbooks/traefik.yml - import_playbook: playbooks/docker-setup-host.yml - import_playbook: playbooks/docker-full-stack-start.yml +- import_playbook: playbooks/postgresql.yml diff --git a/ansible/playbooks/ckan-setup.yml b/ansible/playbooks/ckan-setup.yml new file mode 100644 index 0000000..da1afb6 --- /dev/null +++ b/ansible/playbooks/ckan-setup.yml @@ -0,0 +1,11 @@ +--- +# FILE: playbooks/ckan-setup.yml +# LICENSE: Public Domain +# DESCRIPTION: Install CKAN on the host +# +# REQUIES: roles/ckan (already on this project) +# ansible-playbook -i inventories/etica.dev playbooks/ckan-setup.yml + +- hosts: all + roles: + - ckan diff --git a/ansible/playbooks/postgresql.yml b/ansible/playbooks/postgresql.yml new file mode 100644 index 0000000..39a4dde --- /dev/null +++ b/ansible/playbooks/postgresql.yml @@ -0,0 +1,12 @@ +--- +# FILE: playbooks/postgresql.yml +# LICENSE: Public Domain +# DESCRIPTION: Install postgresql on the host. +# It's used by CKAN. You can skip this playbook +# SEE: https://github.com/geerlingguy/ansible-role-postgresql + +# ansible-playbook -i inventories/etica.dev playbooks/postgresql.yml + +- hosts: all + roles: + - geerlingguy.postgresql diff --git a/ansible/playbooks/roles/ckan/defaults/main.yml b/ansible/playbooks/roles/ckan/defaults/main.yml index 72337bc..ef21dc5 100644 --- a/ansible/playbooks/roles/ckan/defaults/main.yml +++ b/ansible/playbooks/roles/ckan/defaults/main.yml @@ -1,2 +1,6 @@ --- -# defaults file for ckan \ No newline at end of file +# defaults file for ckan + +# This is how the package was created https://github.com/ckan/ckan-packaging/blob/master/package.yml +ckan_package: "python-ckan_2.8-bionic_amd64.deb" +ckan_package_url: "http://packaging.ckan.org/{{ ckan_package }}" diff --git a/ansible/playbooks/roles/ckan/meta/main.yml b/ansible/playbooks/roles/ckan/meta/main.yml index 227ad9c..660e2c1 100644 --- a/ansible/playbooks/roles/ckan/meta/main.yml +++ b/ansible/playbooks/roles/ckan/meta/main.yml @@ -1,43 +1,15 @@ galaxy_info: - author: your name - description: your role description - company: your company (optional) - - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Choose a valid license ID from https://spdx.org - some suggested licenses: - # - BSD-3-Clause (default) - # - MIT - # - GPL-2.0-or-later - # - GPL-3.0-only - # - Apache-2.0 - # - CC-BY-4.0 - license: license (GPL-2.0-or-later, MIT, etc) + author: "Emerson Rocha " + description: CKAN for Ubuntu 18.04 + company: Etica.AI + license: Unlicense min_ansible_version: 2.9 - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 + platforms: + - name: Ubuntu + versions: + - bionic galaxy_tags: [] # List tags for your role here, one per line. A tag is a keyword that describes diff --git a/ansible/playbooks/roles/ckan/tasks/install.yml b/ansible/playbooks/roles/ckan/tasks/install.yml new file mode 100644 index 0000000..6e1b439 --- /dev/null +++ b/ansible/playbooks/roles/ckan/tasks/install.yml @@ -0,0 +1,7 @@ +--- +# FILE: playbooks/roles/ckan/tasks/install.yml +# LICENSE: Public Domain + +- name: "CKAN | Install {{ ckan_package_url }}" + apt: + deb: "{{ ckan_package_url }}" diff --git a/ansible/playbooks/roles/ckan/tasks/main.yml b/ansible/playbooks/roles/ckan/tasks/main.yml index 3f5ba3e..8bd9177 100644 --- a/ansible/playbooks/roles/ckan/tasks/main.yml +++ b/ansible/playbooks/roles/ckan/tasks/main.yml @@ -1,2 +1,27 @@ --- -# tasks file for ckan \ No newline at end of file +# FILE: playbooks/roles/ckan/tasks/main.yml +# LICENSE: Public Domain +# SEE: https://docs.ckan.org/en/2.8/maintaining/installing/install-from-package.html +# SEE: https://docs.ckan.org/en/2.8/maintaining/installing/install-from-source.html + +- name: Ubuntu? + fail: + msg: "This role as designed to only Ubuntu 18.04. Please look for other alternatives" + when: ansible_distribution != 'Ubuntu' + +# # SEE http://packaging.ckan.org/ +# - name: "ping all" +# ping: +# data: pong + +# - name: "Check if {{ traefik_install_base }}traefik exists" +# stat: +# path: "{{ traefik_install_base }}traefik" +# register: stat_result + +# - debug: var=stat_result + +- name: "install.yml" + include: install.yml +# when: +# - "(not stat_result.stat.exists) or (traefik_force_reinstall|bool)" diff --git a/ansible/playbooks/roles/traefik/meta/main.yml b/ansible/playbooks/roles/traefik/meta/main.yml index 227ad9c..3ddb006 100644 --- a/ansible/playbooks/roles/traefik/meta/main.yml +++ b/ansible/playbooks/roles/traefik/meta/main.yml @@ -1,44 +1,11 @@ galaxy_info: - author: your name - description: your role description - company: your company (optional) - - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Choose a valid license ID from https://spdx.org - some suggested licenses: - # - BSD-3-Clause (default) - # - MIT - # - GPL-2.0-or-later - # - GPL-3.0-only - # - Apache-2.0 - # - CC-BY-4.0 - license: license (GPL-2.0-or-later, MIT, etc) + author: "Emerson Rocha " + description: Traefik + company: Etica.AI + license: Unlicense min_ansible_version: 2.9 - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 - galaxy_tags: [] # List tags for your role here, one per line. A tag is a keyword that describes # and categorizes the role. Users find roles by searching for tags. Be sure to diff --git a/ansible/requirements.yml b/ansible/requirements.yml index a209819..bb865c6 100644 --- a/ansible/requirements.yml +++ b/ansible/requirements.yml @@ -13,3 +13,7 @@ # https://github.com/geerlingguy/ansible-role-pip - src: geerlingguy.pip # Tested with v1.3.0, 2018-11-10 + +# https://github.com/geerlingguy/ansible-role-postgresql +- src: geerlingguy.postgresql + # Tested with v2.2.0, 2020-03-20