Files @ b68d19ad38a3
Branch filter:

Location: majic-ansible-roles/roles/database_server/tasks/main.yml

branko
MAR-33: Added initial scaffolding for wsgi_website tests:

- Added Molecule configuration file.
- Implemented test playbook that sets-up three separate instances of WSGI
website in order to test all variations of parameters.
- Added name for the set_fact task.
- Fixed linting errors related to mode that lacks leading zero.
- Added skip_ansible_lint tag for command that creates the Python virtual
environment.
- Added missing become keyword wherever become_user is specified.
- Fixed invalid parameter name for specifying if HTTPS should be enforced or
not.
- Added small initial sample WSGI apps that get deployed.
- Added static/media sample files.
- Added TLS material.
- Added initial dummy test file.
---

- name: Install MariaDB
  apt: name="{{ item }}" state=installed
  with_items:
    - mariadb-client
    - mariadb-server
    - python-mysqldb

- name: Enable MariaDB service on boot (workaround for systemctl broken handling of SysV)
  command: rcconf -on mysql
  register: result
  changed_when: result.stderr == ""

- name: Enable and start MariaDB
  service: name=mysql state=started

- name: Set password for the root database user
  mysql_user: check_implicit_admin=yes name=root password="{{ db_root_password }}"

- name: Deploy username and password for the root database user
  template: src="root_my.cnf.j2" dest="/root/.my.cnf"
            owner=root group=root mode=0400

- name: Set UTF-8 encoding as default for MariaDB
  copy: src="utf8.cnf" dest="/etc/mysql/conf.d/utf8.cnf"
        owner=root group=root mode=0644
  register: mariadb_utf8_configuration

- name: Restart MariaDB in order to use UTF-8 as default character set
  service: name=mysql state=restarted
  when: mariadb_utf8_configuration.changed
  tags:
    # [ANSIBLE0016] Tasks that run when changed should likely be handlers
    #   UTF-8 configuration must be applied immediatelly in order to ensure that
    #   subsequent tasks that create databases will end-up with correct (UTF-8)
    #   encoding. Otherwise they will be created using default latin1.
    - skip_ansible_lint

- name: Explicitly run all handlers
  include: ../handlers/main.yml
  when: "handlers | default(False) | bool() == True"
  tags:
    - handlers