Reorganised folders

pull/63/head
Ivan Grynenko 8 years ago
parent 8e27d903c1
commit 46e1eb29a2
  1. 0
      LICENSE.md
  2. 157
      README.md
  3. 0
      group_vars/all.yml
  4. 0
      hosts
  5. 34
      lemp-rhel7/README.md
  6. 76
      lemp-rhel7/roles/ansible-role-mysql/.travis.yml
  7. 95
      lemp-rhel7/roles/ansible-role-mysql/defaults/main.yml
  8. 3
      lemp-rhel7/roles/ansible-role-mysql/handlers/main.yml
  9. 22
      meta/main.yml
  10. 0
      roles/ansible-role-apache/.travis.yml
  11. 0
      roles/ansible-role-apache/README.md
  12. 0
      roles/ansible-role-apache/defaults/main.yml
  13. 0
      roles/ansible-role-apache/handlers/main.yml
  14. 0
      roles/ansible-role-apache/meta/main.yml
  15. 0
      roles/ansible-role-apache/tasks/configure-Debian.yml
  16. 0
      roles/ansible-role-apache/tasks/configure-RedHat.yml
  17. 0
      roles/ansible-role-apache/tasks/configure-Solaris.yml
  18. 0
      roles/ansible-role-apache/tasks/configure-Suse.yml
  19. 0
      roles/ansible-role-apache/tasks/main.yml
  20. 0
      roles/ansible-role-apache/tasks/setup-Debian.yml
  21. 0
      roles/ansible-role-apache/tasks/setup-RedHat.yml
  22. 0
      roles/ansible-role-apache/tasks/setup-Solaris.yml
  23. 0
      roles/ansible-role-apache/tasks/setup-Suse.yml
  24. 0
      roles/ansible-role-apache/templates/vhosts.conf.j2
  25. 0
      roles/ansible-role-apache/tests/Dockerfile.centos-6
  26. 0
      roles/ansible-role-apache/tests/Dockerfile.centos-7
  27. 0
      roles/ansible-role-apache/tests/Dockerfile.ubuntu-12.04
  28. 0
      roles/ansible-role-apache/tests/Dockerfile.ubuntu-14.04
  29. 0
      roles/ansible-role-apache/tests/test.yml
  30. 0
      roles/ansible-role-apache/vars/Debian.yml
  31. 0
      roles/ansible-role-apache/vars/RedHat.yml
  32. 0
      roles/ansible-role-apache/vars/Solaris.yml
  33. 0
      roles/ansible-role-apache/vars/Suse.yml
  34. 0
      roles/ansible-role-apache/vars/apache-22.yml
  35. 0
      roles/ansible-role-apache/vars/apache-24.yml
  36. 0
      roles/ansible-role-composer/.travis.yml
  37. 0
      roles/ansible-role-composer/README.md
  38. 0
      roles/ansible-role-composer/defaults/main.yml
  39. 0
      roles/ansible-role-composer/meta/main.yml
  40. 0
      roles/ansible-role-composer/tasks/global-require.yml
  41. 0
      roles/ansible-role-composer/tasks/main.yml
  42. 0
      roles/ansible-role-composer/templates/auth.json.j2
  43. 0
      roles/ansible-role-composer/templates/composer.sh.j2
  44. 0
      roles/ansible-role-composer/tests/inventory
  45. 0
      roles/ansible-role-composer/tests/test-global-require.yml
  46. 0
      roles/ansible-role-composer/tests/test.yml
  47. 0
      roles/ansible-role-drupal-console/.travis.yml
  48. 0
      roles/ansible-role-drupal-console/README.md
  49. 0
      roles/ansible-role-drupal-console/defaults/main.yml
  50. 0
      roles/ansible-role-drupal-console/meta/main.yml
  51. 0
      roles/ansible-role-drupal-console/tasks/main.yml
  52. 0
      roles/ansible-role-drupal-console/tests/inventory
  53. 0
      roles/ansible-role-drupal-console/tests/test-self-update.yml
  54. 0
      roles/ansible-role-drupal-console/tests/test.yml
  55. 0
      roles/ansible-role-drush/.travis.yml
  56. 0
      roles/ansible-role-drush/README.md
  57. 0
      roles/ansible-role-drush/defaults/main.yml
  58. 0
      roles/ansible-role-drush/meta/main.yml
  59. 0
      roles/ansible-role-drush/tasks/main.yml
  60. 0
      roles/ansible-role-drush/tests/inventory
  61. 0
      roles/ansible-role-drush/tests/test.yml
  62. 0
      roles/ansible-role-git/.gitignore
  63. 0
      roles/ansible-role-git/.travis.yml
  64. 0
      roles/ansible-role-git/README.md
  65. 0
      roles/ansible-role-git/defaults/main.yml
  66. 0
      roles/ansible-role-git/meta/main.yml
  67. 0
      roles/ansible-role-git/tasks/install-from-source.yml
  68. 0
      roles/ansible-role-git/tasks/main.yml
  69. 0
      roles/ansible-role-git/tests/Dockerfile.centos-6
  70. 0
      roles/ansible-role-git/tests/Dockerfile.centos-7
  71. 0
      roles/ansible-role-git/tests/Dockerfile.ubuntu-12.04
  72. 0
      roles/ansible-role-git/tests/Dockerfile.ubuntu-14.04
  73. 0
      roles/ansible-role-git/tests/test-package.yml
  74. 0
      roles/ansible-role-git/tests/test-source.yml
  75. 0
      roles/ansible-role-git/vars/main.yml
  76. 0
      roles/ansible-role-memcached/.gitignore
  77. 0
      roles/ansible-role-memcached/.travis.yml
  78. 0
      roles/ansible-role-memcached/README.md
  79. 0
      roles/ansible-role-memcached/defaults/main.yml
  80. 0
      roles/ansible-role-memcached/handlers/main.yml
  81. 0
      roles/ansible-role-memcached/meta/main.yml
  82. 0
      roles/ansible-role-memcached/tasks/main.yml
  83. 0
      roles/ansible-role-memcached/tasks/setup-Debian.yml
  84. 0
      roles/ansible-role-memcached/tasks/setup-RedHat.yml
  85. 0
      roles/ansible-role-memcached/templates/memcached-Debian.conf.j2
  86. 0
      roles/ansible-role-memcached/templates/memcached-RedHat.conf.j2
  87. 0
      roles/ansible-role-memcached/tests/inventory
  88. 0
      roles/ansible-role-memcached/tests/test.yml
  89. 0
      roles/ansible-role-memcached/vars/Debian.yml
  90. 0
      roles/ansible-role-memcached/vars/RedHat.yml
  91. 0
      roles/ansible-role-mysql/.travis.yml
  92. 0
      roles/ansible-role-mysql/README.md
  93. 0
      roles/ansible-role-mysql/defaults/main.yml
  94. 0
      roles/ansible-role-mysql/handlers/main.yml
  95. 0
      roles/ansible-role-mysql/meta/main.yml
  96. 0
      roles/ansible-role-mysql/tasks/configure.yml
  97. 0
      roles/ansible-role-mysql/tasks/databases.yml
  98. 0
      roles/ansible-role-mysql/tasks/main.yml
  99. 0
      roles/ansible-role-mysql/tasks/replication.yml
  100. 0
      roles/ansible-role-mysql/tasks/secure-installation.yml
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,143 +1,34 @@
# Ansible Role: MySQL
## WordPress+Nginx+PHP-FPM+MariaDB Deployment
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-mysql.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-mysql)
- Requires Ansible 1.2 or newer
- Expects CentOS/RHEL 7.x host/s
Installs and configures MySQL or MariaDB server on RHEL/CentOS or Debian/Ubuntu servers.
RHEL7 version reflects changes in Red Hat Enterprise Linux and CentOS 7:
1. Network device naming scheme has changed
2. iptables is replaced with firewalld
3. MySQL is replaced with MariaDB
## Requirements
These playbooks deploy a simple all-in-one configuration of the popular
WordPress blogging platform and CMS, frontend by the Nginx web server and the
PHP-FPM process manager. To use, copy the `hosts.example` file to `hosts` and
edit the `hosts` inventory file to include the names or URLs of the servers
you want to deploy.
No special requirements; note that this role requires root access, so either run it in a playbook with a global `become: yes`, or invoke the role in your playbook like:
Then run the playbook, like this:
- hosts: database
roles:
- role: geerlingguy.mysql
become: yes
ansible-playbook -i hosts site.yml
## Role Variables
The playbooks will configure MariaDB, WordPress, Nginx, and PHP-FPM. When the run
is complete, you can hit access server to begin the WordPress configuration.
Available variables are listed below, along with default values (see `defaults/main.yml`):
### Ideas for Improvement
mysql_user_home: /root
Here are some ideas for ways that these playbooks could be extended:
The home directory inside which Python MySQL settings will be stored, which Ansible will use when connecting to MySQL. This should be the home directory of the user which runs this Ansible role.
- Parameterize the WordPress deployment to handle multi-site configurations.
- Separate the components (PHP-FPM, MySQL, Nginx) onto separate hosts and
handle the configuration appropriately.
- Handle WordPress upgrades automatically.
mysql_root_password: root
The MySQL root user account password.
mysql_root_password_update: no
Whether to force update the MySQL root user's password. By default, this role will only change the root user's password when MySQL is first configured. You can force an update by setting this to `yes`.
> Note: If you get an error like `ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)` after a failed or interrupted playbook run, this usually means the root password wasn't originally updated to begin with. Try either removing the `.my.cnf` file inside the configured `mysql_user_home` or updating it and setting `password=''` (the insecure default password). Run the playbook again, with `mysql_root_password_update` set to `yes`, and the setup should complete.
mysql_enabled_on_startup: yes
Whether MySQL should be enabled on startup.
overwrite_global_mycnf: yes
Whether the global my.cnf should be overwritten each time this role is run. Setting this to `no` tells Ansible to only create the `my.cnf` file if it doesn't exist. This should be left at its default value (`yes`) if you'd like to use this role's variables to configure MySQL.
mysql_config_include_files: []
A list of files that should override the default global my.cnf. Each item in the array requires a "src" parameter which is a path to a file. An optional "force" parameter can force the file to be updated each time ansible runs.
mysql_databases: []
The MySQL databases to create. A database has the values `name`, `encoding` (defaults to `utf8`), `collation` (defaults to `utf8_general_ci`) and `replicate` (defaults to `1`, only used if replication is configured). The formats of these are the same as in the `mysql_db` module.
mysql_users: []
The MySQL users and their privileges. A user has the values `name`, `host` (defaults to `localhost`), `password`, `priv` (defaults to `*.*:USAGE`), `append_privs` (defaults to `no`), `state` (defaults to `present`). The formats of these are the same as in the `mysql_user` module.
mysql_packages:
- mysql
- mysql-server
(OS-specific, RedHat/CentOS defaults listed here) Packages to be installed. In some situations, you may need to add additional packages, like `mysql-devel`.
mysql_enablerepo: ""
(RedHat/CentOS only) If you have enabled any additional repositories (might I suggest geerlingguy.repo-epel or geerlingguy.repo-remi), those repositories can be listed under this variable (e.g. `remi,epel`). This can be handy, as an example, if you want to install later versions of MySQL.
mysql_port: "3306"
mysql_bind_address: '0.0.0.0'
mysql_datadir: /var/lib/mysql
Default MySQL connection configuration.
mysql_log: ""
mysql_log_error: /var/log/mysqld.log
mysql_syslog_tag: mysqld
MySQL logging configuration. Setting `mysql_log` (the general query log) or `mysql_log_error` to `syslog` will make MySQL log to syslog using the `mysql_syslog_tag`.
mysql_slow_query_log_enabled: no
mysql_slow_query_log_file: /var/log/mysql-slow.log
mysql_slow_query_time: 2
Slow query log settings. Note that the log file will be created by this role, but if you're running on a server with SELinux or AppArmor, you may need to add this path to the allowed paths for MySQL, or disable the mysql profile. For example, on Debian/Ubuntu, you can run `sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/usr.sbin.mysqld && sudo service apparmor restart`.
mysql_key_buffer_size: "256M"
mysql_max_allowed_packet: "64M"
mysql_table_open_cache: "256"
[...]
The rest of the settings in `defaults/main.yml` control MySQL's memory usage. The default values are tuned for a server where MySQL can consume ~512 MB RAM, so you should consider adjusting them to suit your particular server better.
mysql_server_id: "1"
mysql_max_binlog_size: "100M"
mysql_expire_logs_days: "10"
mysql_replication_role: ''
mysql_replication_master: ''
mysql_replication_user: []
Replication settings. Set `mysql_server_id` and `mysql_replication_role` by server (e.g. the master would be ID `1`, with the `mysql_replication_role` of `master`, and the slave would be ID `2`, with the `mysql_replication_role` of `slave`). The `mysql_replication_user` uses the same keys as `mysql_users`, and is created on master servers, and used to replicate on all the slaves.
### MariaDB usage
This role works with either MySQL or a compatible version of MariaDB. On RHEL/CentOS 7+, the mariadb database engine was substituted as the default MySQL replacement package. No modifications are necessary though all of the variables still reference 'mysql' instead of mariadb.
#### Ubuntu 14.04 and 16.04 MariaDB configuration
On Ubuntu, the package names are named differently, so the `mysql_package` variable needs to be altered. Set the following variables (at a minimum):
mysql_packages:
- mariadb-client
- mariadb-server
- python-mysqldb
## Dependencies
None.
## Example Playbook
- hosts: db-servers
become: yes
vars_files:
- vars/main.yml
roles:
- { role: geerlingguy.mysql }
*Inside `vars/main.yml`*:
mysql_root_password: super-secure-password
mysql_databases:
- name: example_db
encoding: latin1
collation: latin1_general_ci
mysql_users:
- name: example_user
host: "%"
password: similarly-secure-password
priv: "example_db.*:ALL"
## License
MIT / BSD
## Author Information
This role was created in 2014 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/).
We would love to see contributions and improvements, so please fork this
repository on GitHub and send us your changes via pull requests.

@ -1,34 +0,0 @@
## WordPress+Nginx+PHP-FPM+MariaDB Deployment
- Requires Ansible 1.2 or newer
- Expects CentOS/RHEL 7.x host/s
RHEL7 version reflects changes in Red Hat Enterprise Linux and CentOS 7:
1. Network device naming scheme has changed
2. iptables is replaced with firewalld
3. MySQL is replaced with MariaDB
These playbooks deploy a simple all-in-one configuration of the popular
WordPress blogging platform and CMS, frontend by the Nginx web server and the
PHP-FPM process manager. To use, copy the `hosts.example` file to `hosts` and
edit the `hosts` inventory file to include the names or URLs of the servers
you want to deploy.
Then run the playbook, like this:
ansible-playbook -i hosts site.yml
The playbooks will configure MariaDB, WordPress, Nginx, and PHP-FPM. When the run
is complete, you can hit access server to begin the WordPress configuration.
### Ideas for Improvement
Here are some ideas for ways that these playbooks could be extended:
- Parameterize the WordPress deployment to handle multi-site configurations.
- Separate the components (PHP-FPM, MySQL, Nginx) onto separate hosts and
handle the configuration appropriately.
- Handle WordPress upgrades automatically.
We would love to see contributions and improvements, so please fork this
repository on GitHub and send us your changes via pull requests.

@ -1,76 +0,0 @@
---
sudo: required
env:
- distribution: centos
version: 6
init: /sbin/init
run_opts: ""
playbook: test.yml
- distribution: centos
version: 7
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: centos-7-test.yml
- distribution: ubuntu
version: 14.04
init: /sbin/init
run_opts: ""
playbook: test.yml
# - distribution: ubuntu
# version: 12.04
# init: /sbin/init
# run_opts: ""
# playbook: test.yml
services:
- docker
before_install:
# Pull container
- 'sudo docker pull ${distribution}:${version}'
# Customize container
- 'sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests'
script:
- container_id=$(mktemp)
# Run container in detached state
- 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"'
# Ansible syntax check.
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} --syntax-check'
# Test role.
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook}'
# Test role idempotence.
- >
sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook}
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Some MySQL debugging (show all the logs).
- sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ls -lah /var/log
- sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm cat /var/log/mysql/error.log || true
- sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm cat /var/log/mysql.err || true
# Check to make sure we can connect to MySQL via Unix socket.
- >
sudo docker exec "$(cat ${container_id})" mysql -u root -proot -e 'show databases;'
| grep -q 'information_schema'
&& (echo 'MySQL running normally' && exit 0)
|| (echo 'MySQL not running' && exit 1)
# Check to make sure we can connect to MySQL via TCP.
- >
sudo docker exec "$(cat ${container_id})" mysql -u root -proot -h 127.0.0.1 -e 'show databases;'
| grep -q 'information_schema'
&& (echo 'MySQL running normally' && exit 0)
|| (echo 'MySQL not running' && exit 1)
# Clean up
- sudo docker stop "$(cat ${container_id})"
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

@ -1,95 +0,0 @@
---
mysql_user_home: /root
mysql_root_username: root
mysql_root_password: root
# Set this to `yes` to forcibly update the root password.
mysql_root_password_update: no
mysql_enabled_on_startup: yes
# update my.cnf. each time role is run? yes | no
overwrite_global_mycnf: yes
# Pass in a comma-separated list of repos to use (e.g. "remi,epel"). Used only
# for RedHat systems (and derivatives).
mysql_enablerepo: ""
# Define a custom list of packages to install; if none provided, the default
# package list from vars/[OS-family].yml will be used.
# mysql_packages:
# - mysql
# - mysql-server
# - MySQL-python
# MySQL connection settings.
mysql_port: "3306"
mysql_bind_address: '0.0.0.0'
mysql_datadir: /var/lib/mysql
mysql_pid_file: /var/run/mysqld/mysqld.pid
mysql_skip_name_resolve: no
# Slow query log settings.
mysql_slow_query_log_enabled: no
mysql_slow_query_log_file: /var/log/mysql-slow.log
mysql_slow_query_time: 2
# Memory settings (default values optimized ~512MB RAM).
mysql_key_buffer_size: "256M"
mysql_max_allowed_packet: "64M"
mysql_table_open_cache: "256"
mysql_sort_buffer_size: "1M"
mysql_read_buffer_size: "1M"
mysql_read_rnd_buffer_size: "4M"
mysql_myisam_sort_buffer_size: "64M"
mysql_thread_cache_size: "8"
mysql_query_cache_size: "16M"
mysql_max_connections: 151
# Other settings.
mysql_wait_timeout: 28800
# InnoDB settings.
# Set .._buffer_pool_size up to 80% of RAM but beware of setting too high.
mysql_innodb_file_per_table: "1"
mysql_innodb_buffer_pool_size: "256M"
# Set .._log_file_size to 25% of buffer pool size.
mysql_innodb_log_file_size: "64M"
mysql_innodb_log_buffer_size: "8M"
mysql_innodb_flush_log_at_trx_commit: "1"
mysql_innodb_lock_wait_timeout: 50
# mysqldump settings.
mysql_mysqldump_max_allowed_packet: "64M"
# Logging settings.
mysql_log: ""
mysql_log_error: /var/log/mysql.err
mysql_syslog_tag: mysql
mysql_config_include_files: []
# - src: path/relative/to/playbook/file.cnf
# - { src: path/relative/to/playbook/anotherfile.cnf, force: yes }
# Databases.
mysql_databases: []
# - name: example
# collation: utf8_general_ci
# encoding: utf8
# replicate: 1
# Users.
mysql_users: []
# - name: example
# host: 127.0.0.1
# password: secret
# priv: *.*:USAGE
# Replication settings (replication is only enabled if master/user have values).
mysql_server_id: "1"
mysql_max_binlog_size: "100M"
mysql_expire_logs_days: "10"
mysql_replication_role: ''
mysql_replication_master: ''
# Same keys as `mysql_users` above.
mysql_replication_user: []

@ -1,3 +0,0 @@
---
- name: restart mysql
service: "name={{ mysql_daemon }} state=restarted sleep=5"

@ -1,22 +0,0 @@
---
dependencies: []
galaxy_info:
author: geerlingguy
description: MySQL server for RHEL/CentOS and Debian/Ubuntu.
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 1.9
platforms:
- name: EL
versions:
- 6
- 7
- name: Ubuntu
versions:
- all
- name: Debian
versions:
- all
galaxy_tags:
- database

Some files were not shown because too many files have changed in this diff Show More