parent
							
								
									c338867c47
								
							
						
					
					
						commit
						5d444eec07
					
				| 
						 | 
				
			
			@ -5,7 +5,6 @@
 | 
			
		|||
# -------------------------------------
 | 
			
		||||
mariadb_origin: 'default'
 | 
			
		||||
mariadb_use_galera: false
 | 
			
		||||
mariadb_root_password: null 
 | 
			
		||||
mariadb_notify_restart: true
 | 
			
		||||
mariadb_upstream_apt_src: false
 | 
			
		||||
mariadb_manage_logrotate: true
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,29 +1,5 @@
 | 
			
		|||
---
 | 
			
		||||
 | 
			
		||||
- name: SHELL | Get MariaDB target version
 | 
			
		||||
  shell: "LANG=C apt-cache depends mariadb-server | awk -F '-' '/Depends/ { print $NF }'"
 | 
			
		||||
  register: apt_mariadb_version
 | 
			
		||||
  changed_when: false
 | 
			
		||||
 | 
			
		||||
- block:
 | 
			
		||||
 | 
			
		||||
  - name: DEBCONF | Prepare MariaDB silent installation (root password)
 | 
			
		||||
    debconf:
 | 
			
		||||
      name: 'mariadb-server-{{ apt_mariadb_version.stdout }}'
 | 
			
		||||
      question: 'mysql-server/root_password'
 | 
			
		||||
      vtype: 'password'
 | 
			
		||||
      value: '{{ mariadb_root_password }}'
 | 
			
		||||
    when: not mariadb_exists.stat.exists
 | 
			
		||||
  
 | 
			
		||||
  - name: DEBCONF | Prepare MariaDB silent installation (root password again)
 | 
			
		||||
    debconf:
 | 
			
		||||
      name: 'mariadb-server-{{ apt_mariadb_version.stdout }}'
 | 
			
		||||
      question: 'mysql-server/root_password_again'
 | 
			
		||||
      vtype: 'password'
 | 
			
		||||
      value: '{{ mariadb_root_password }}'
 | 
			
		||||
 | 
			
		||||
  when: not mariadb_exists.stat.exists and mariadb_root_password is string
 | 
			
		||||
 | 
			
		||||
- name: APT | Install MariaDB server
 | 
			
		||||
  apt:
 | 
			
		||||
    pkg: mariadb-server
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,13 +1,5 @@
 | 
			
		|||
---
 | 
			
		||||
 | 
			
		||||
- block:
 | 
			
		||||
 | 
			
		||||
    - name: SET_FACT | Bypass https://github.com/ansible/ansible/issues/19874
 | 
			
		||||
      set_fact:
 | 
			
		||||
        ansible_distribution_release: 'buster'
 | 
			
		||||
 | 
			
		||||
  when: ansible_facts.distribution_major_version == "buster/sid"
 | 
			
		||||
 | 
			
		||||
- name: INCLUDE_VARS | Related to OS version
 | 
			
		||||
  include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -40,15 +32,6 @@
 | 
			
		|||
    (config.changed or extraconfig.changed) and
 | 
			
		||||
    not mariadb_galera_resetup
 | 
			
		||||
 | 
			
		||||
- name: TEMPLATE Create .my.cnf for root
 | 
			
		||||
  template:
 | 
			
		||||
    src: root/my.cnf
 | 
			
		||||
    dest: /root/.my.cnf
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    mode: 0600
 | 
			
		||||
    backup: yes
 | 
			
		||||
 | 
			
		||||
- name: INCLUDE | Galera
 | 
			
		||||
  import_tasks: galera/main.yml
 | 
			
		||||
  when: mariadb_use_galera
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,16 +1,5 @@
 | 
			
		|||
---
 | 
			
		||||
 | 
			
		||||
- name: MYSQL_USER | Update mysql root password for all root accounts
 | 
			
		||||
  mysql_user:
 | 
			
		||||
    name: root
 | 
			
		||||
    host: "{{ item }}"
 | 
			
		||||
    password: "{{ mariadb_root_password }}"
 | 
			
		||||
  loop:
 | 
			
		||||
    - "{{ ansible_hostname }}"
 | 
			
		||||
    - 127.0.0.1
 | 
			
		||||
    - ::1
 | 
			
		||||
    - localhost
 | 
			
		||||
 | 
			
		||||
- name: MYSQL_USER | Remove all anonymous users
 | 
			
		||||
  mysql_user:
 | 
			
		||||
    name: ''
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +0,0 @@
 | 
			
		|||
# ------------------------------------------
 | 
			
		||||
# {{ ansible_managed }}
 | 
			
		||||
# ------------------------------------------
 | 
			
		||||
 | 
			
		||||
[client]
 | 
			
		||||
user=root
 | 
			
		||||
password="{{ mariadb_root_password }}"
 | 
			
		||||
		Loading…
	
		Reference in New Issue