Install SQL using Ansible

ansible 5 years, 9 months ago
--- #give the IP address of the hosts you want to install SQL - hosts: XXXX sudo: yes vars: mysql_root_password: XXX tasks: - name: Install MySQL apt: name={{ item }} update_cache=yes cache_valid_time=3600 state=present sudo: yes with_items: - python-mysqldb - mysql-server - name: Start the MySQL service sudo: yes service: name: mysql state: started enabled: true - name: update mysql root password for all root accounts sudo: yes mysql_user: name: XXX host: "{{ item }}" password: "{{ mysql_root_password }}" login_user: XXX login_password: "{{ mysql_root_password }}" check_implicit_admin: yes priv: "*.*:ALL,GRANT" with_items: - "{{ ansible_hostname }}" - 127.0.0.1 - ::1 - localhost
1180
Posted By