mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Update main.yml
This commit is contained in:
parent
9161a17ef2
commit
09808e1e8b
1 changed files with 61 additions and 32 deletions
|
@ -1,6 +1,7 @@
|
||||||
- name: Install MySQL (debuntu)
|
- name: Install MySQL (debuntu)
|
||||||
package: name={{ item }}
|
package:
|
||||||
state=present
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
- mariadb-server
|
- mariadb-server
|
||||||
- mariadb-client
|
- mariadb-client
|
||||||
|
@ -18,17 +19,22 @@
|
||||||
tags:
|
tags:
|
||||||
- download
|
- download
|
||||||
|
|
||||||
- name: php-xml for 'ubuntu' and 'debian-9'
|
- name: php-xml (ubuntu or debian_9)
|
||||||
package: name=php{{ php_version }}-xml state=present
|
package:
|
||||||
|
name: "php{{ php_version }}-xml"
|
||||||
|
state: present
|
||||||
when: is_ubuntu or is_debian_9
|
when: is_ubuntu or is_debian_9
|
||||||
|
|
||||||
- name: php-xml for 'debian-8'
|
- name: php-xml (debian_8)
|
||||||
package: name=php-xml-parser state=present
|
package:
|
||||||
|
name: "php-xml-parser"
|
||||||
|
state: present
|
||||||
when: is_debian_8
|
when: is_debian_8
|
||||||
|
|
||||||
- name: Install MySQL (OS's other than debuntu)
|
- name: Install MySQL (OS's other than debuntu)
|
||||||
package: name={{ item }}
|
package:
|
||||||
state=present
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
- MySQL-python
|
- MySQL-python
|
||||||
- mysql
|
- mysql
|
||||||
|
@ -57,29 +63,43 @@
|
||||||
|
|
||||||
# Name of mysql service varies by OS so softcoded in 1-prep
|
# Name of mysql service varies by OS so softcoded in 1-prep
|
||||||
- name: Start the MySQL service
|
- name: Start the MySQL service
|
||||||
service: name={{ mysql_service }}
|
service:
|
||||||
state=started
|
name: "{{ mysql_service }}"
|
||||||
|
state: started
|
||||||
|
|
||||||
- name: Enable the MySQL service
|
- name: Enable the MySQL service
|
||||||
service: name={{ mysql_service }}
|
service:
|
||||||
enabled=yes
|
name: "{{ mysql_service }}"
|
||||||
|
enabled: yes
|
||||||
when: mysql_enabled
|
when: mysql_enabled
|
||||||
|
|
||||||
# 'localhost' needs to be the last item for idempotency, see
|
# 'localhost' needs to be the last item for idempotency, see
|
||||||
# http://ansible.cc/docs/modules.html#mysql-user
|
# http://ansible.cc/docs/modules.html#mysql-user
|
||||||
# unfortunately it still doesn't work
|
# unfortunately it still doesn't work
|
||||||
- name: Update MySQL root password for localhost root accounts
|
- name: Update MySQL root password for localhost root accounts
|
||||||
mysql_user: name=root host={{ item }} password={{ mysql_root_password }} priv=*.*:ALL,GRANT
|
mysql_user:
|
||||||
|
name: root
|
||||||
|
host: "{{ item }}"
|
||||||
|
password: "{{ mysql_root_password }}"
|
||||||
|
priv: "*.*:ALL,GRANT"
|
||||||
with_items:
|
with_items:
|
||||||
- localhost
|
- localhost
|
||||||
when: mysql_enabled
|
when: mysql_enabled
|
||||||
|
|
||||||
- name: Copy .my.cnf file with root password credentials
|
- name: Copy .my.cnf file with root password credentials
|
||||||
template: src=my.cnf.j2 dest=/root/.my.cnf owner=root mode=0600
|
template:
|
||||||
|
src: my.cnf.j2
|
||||||
|
dest: /root/.my.cnf
|
||||||
|
owner: root
|
||||||
|
mode: 0600
|
||||||
when: mysql_enabled
|
when: mysql_enabled
|
||||||
|
|
||||||
- name: Update MySQL root password for all remaining root accounts
|
- name: Update MySQL root password for all remaining root accounts
|
||||||
mysql_user: name=root host={{ item }} password={{ mysql_root_password }} priv=*.*:ALL,GRANT
|
mysql_user:
|
||||||
|
name: root
|
||||||
|
host: "{{ item }}"
|
||||||
|
password: "{{ mysql_root_password }}"
|
||||||
|
priv: "*.*:ALL,GRANT"
|
||||||
with_items:
|
with_items:
|
||||||
# - "{{ iiab_hostname }}.{{ iiab_domain }}"
|
# - "{{ iiab_hostname }}.{{ iiab_domain }}"
|
||||||
- 127.0.0.1
|
- 127.0.0.1
|
||||||
|
@ -87,32 +107,41 @@
|
||||||
when: mysql_enabled
|
when: mysql_enabled
|
||||||
|
|
||||||
- name: Delete anonymous MySQL server user for {{ ansible_hostname }}
|
- name: Delete anonymous MySQL server user for {{ ansible_hostname }}
|
||||||
mysql_user: user="" host="{{ ansible_hostname }}" state="absent"
|
mysql_user:
|
||||||
|
user: ""
|
||||||
|
host: "{{ ansible_hostname }}"
|
||||||
|
state: absent
|
||||||
when: mysql_enabled
|
when: mysql_enabled
|
||||||
|
|
||||||
- name: Delete anonymous MySQL server user for localhost
|
- name: Delete anonymous MySQL server user for localhost
|
||||||
mysql_user: user="" state="absent"
|
mysql_user:
|
||||||
|
user: ""
|
||||||
|
state: absent
|
||||||
when: mysql_enabled
|
when: mysql_enabled
|
||||||
|
|
||||||
- name: Remove the MySQL test database
|
- name: Remove the MySQL test database
|
||||||
mysql_db: db=test state=absent
|
mysql_db:
|
||||||
|
db: test
|
||||||
|
state: absent
|
||||||
when: mysql_enabled
|
when: mysql_enabled
|
||||||
|
|
||||||
# we had to start mysql in order to configure it, now turn if off if not enabled
|
# we had to start mysql in order to configure it, now turn if off if not enabled
|
||||||
- name: Provisionally Disable the MySQL service
|
- name: Provisionally Disable the MySQL service
|
||||||
service: name={{ mysql_service }}
|
service:
|
||||||
enabled=no
|
name: "{{ mysql_service }}"
|
||||||
state=stopped
|
enabled: no
|
||||||
|
state: stopped
|
||||||
when: not mysql_enabled
|
when: not mysql_enabled
|
||||||
|
|
||||||
- name: Add 'mysql' to service list
|
- name: Add 'mysql' to list of services at /etc/iiab/iiab.ini
|
||||||
ini_file: dest='{{ service_filelist }}'
|
ini_file:
|
||||||
section=mysql
|
dest: "{{ service_filelist }}"
|
||||||
option='{{ item.option }}'
|
section: mysql
|
||||||
value='{{ item.value }}'
|
option: "{{ item.option }}"
|
||||||
|
value: "{{ item.value }}"
|
||||||
with_items:
|
with_items:
|
||||||
- option: name
|
- option: name
|
||||||
value: mysql-database
|
value: MySQL
|
||||||
- option: description
|
- option: description
|
||||||
value: '"MySQL is a widely used free and open source (GPLv2) database, offered by most web hosting services, on a diversity of platforms."'
|
value: '"MySQL is a widely used free and open source (GPLv2) database, offered by most web hosting services, on a diversity of platforms."'
|
||||||
- option: enabled
|
- option: enabled
|
||||||
|
|
Loading…
Reference in a new issue