--- - name: "Send mattermost message" uri: url: "{{ mattermost_hook_smardigo }}" method: POST body: "{{ lookup('template','mattermost-deploy-start.json.j2') }}" body_format: json headers: Content-Type: "application/json" delegate_to: 127.0.0.1 become: false when: - send_status_messages - name: Update apt: update_cache=yes force_apt_get=yes cache_valid_time=3600 - name: MariaDB | install package: name: "{{ item }}" state: latest with_items: - mariadb-server - python3-pymysql - name: Fix binding.. ansible.builtin.lineinfile: path: /etc/mysql/mariadb.conf.d/50-server.cnf regexp: '^bind-address' line: 'bind-address={{ ansible_all_ipv4_addresses | ansible.netcommon.ipaddr(shared_service_network) | first }}' - name: Ensure service is started service: name: mariadb state: restarted enabled: yes - name: Check if root password is set shell: > mysqladmin -u root status changed_when: false failed_when: false register: root_pwd_check - name: Set MariaDB root password for the first time mysql_user: name: root password: "{{ mysql_root_password }}" host_all: yes login_unix_socket: /var/run/mysqld/mysqld.sock state: present when: root_pwd_check.rc == 0 - name: Ensure MySQL databases are present. mysql_db: name: "{{ item.name }}" collation: "{{ item.collation | default('utf8_general_ci') }}" encoding: "{{ item.encoding | default('utf8') }}" state: "{{ item.state | default('present') }}" config_file: "/etc/mysql/mariadb.conf.d/50-client.cnf" login_password: "{{ mysql_root_password }}" with_items: "{{ mysql_databases }}" - name: Ensure MySQL users are present. mysql_user: name: "{{ item.name }}" password: "{{ item.password }}" priv: "{{ item.priv | default('*.*:USAGE') }}" state: "{{ item.state | default('present') }}" append_privs: "{{ item.append_privs | default('no') }}" encrypted: "{{ item.encrypted | default('no') }}" config_file: "/etc/mysql/mariadb.conf.d/50-client.cnf" login_password: "{{ mysql_root_password }}" host: "{{ item.host }}" with_items: "{{ mysql_users }}" - name: "Send mattermost messsge" uri: url: "{{ mattermost_hook_smardigo }}" method: POST body: "{{ lookup('template','mattermost-deploy-end.json.j2') }}" body_format: json headers: Content-Type: "application/json" delegate_to: 127.0.0.1 become: false when: - send_status_messages