Skip to content
Snippets Groups Projects
Commit df47d29b authored by nimrod's avatar nimrod
Browse files

Merge branch 'master' of /home/nimrod/Documents/Shore/Ansible/ansible-role-example

parents 9126d19d 7e3b6b88
No related branches found
No related tags found
No related merge requests found
*.sw[po]
~*
*~
*.swp
*.swo
.DS_Store
__pycache__
*.py[cod]
.cache/
.molecule/
.vagrant/
*.log
*.retry
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: cf550fcab3f12015f8676b8278b30e1a5bc10e70
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: 6dfcb89af3c9b4d172cc2e5a8a2fa0f54615a338
hooks:
- id: check-added-large-files
- id: check-json
- id: check-xml
- id: check-yaml
- id: check-merge-conflict
- repo: https://www.shore.co.il/git/ansible-pre-commit/
sha: 94b506c144d4e22ebc1deef637a818db13bcaca5
hooks:
- id: ansible-pre-commit
The MIT License (MIT)
Copyright (c) [year] [fullname]
Copyright (c) 2016 Adar Nimrod
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
ansible-mysql
#############
MySQL
#####
An Ansible role to install and configure a MySQL server. The role creates an
admin account, force SSL usage, configures UFW and daily backup.
......@@ -7,47 +7,43 @@ admin account, force SSL usage, configures UFW and daily backup.
Requirements
------------
Debian Wheezy or later (Ubuntu Precise or later should probably work, but it's
untested).
See :code:`meta/main.yml` and assertions at top of :code:`tasks/main.yml`.
Role Variables
--------------
::
mysql_admin_password: #The password for the admin account.
See :code:`defaults/main.yml`.
Dependencies
------------
`Common role <https://www.shore.co.il/cgit/ansible-common/>`_
See :code:`meta/main.yml`.
Example Playbook
----------------
::
- hosts: servers
roles:
- role: mysql
mysql_admin_password: qwerty123
See :code:`tests/playbook.yml`.
Example requirements.yml
------------------------
::
Testing
-------
To install the dependencies:
.. code:: shell
ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles
- src: https://www.shore.co.il/cgit/ansible-common
scm: git
path: roles/
name: common
To run the full test suite:
- src: https://www.shore.co.il/cgit/ansible-mysql
scm: git
path: roles/
name: mysql
.. code:: shell
molecule test
License
-------
This software is licnesed under the MIT licese (see the ``LICENSE.txt`` file).
This software is licensed under the MIT license (see the :code:`LICENSE.txt`
file).
Author Information
------------------
......@@ -55,12 +51,4 @@ Author Information
Nimrod Adar, `contact me <nimrod@shore.co.il>`_ or visit my `website
<https://www.shore.co.il/>`_. Patches are welcome via `git send-email
<http://git-scm.com/book/en/v2/Git-Commands-Email>`_. The repository is located
at: https://www.shore.co.il/cgit/.
TODO
----
- Don't set a password for the root account, it's only accessible from the
machine itself. Instead create an admin account, without root priviliges and
with mandatory SSL for connecting. Also, other roles will set mandatory SSL
for their connections.
at: https://www.shore.co.il/git/.
[defaults]
host_key_checking = False
retry_files_enabled = False
roles_path = roles:../:../../:.molecule/roles
command_warnings = True
deprecation_warnings = True
---
# defaults file for ansible-mysql
# defaults file for ansible-role-mysql
mysql_admin_password:
---
# handlers file for ansible-mysql
# handlers file for ansible-role-mysql
- name: Restart MySQL
service:
......
......@@ -4,7 +4,7 @@ galaxy_info:
description: MySQL role. For more information read the README file.
company: Shore technologies
license: MIT
min_ansible_version: 1.9
min_ansible_version: 2.0
platforms:
- name: Debian
versions:
......@@ -14,7 +14,7 @@ galaxy_info:
versions:
- precise
- trusty
categories:
- database
dependencies:
- role: common
- src: https://www.shore.co.il/git/ansible-role-ca-store
scm: git
name: ca-store
---
ansible:
verbose: v
playbook: tests/playbook.yml
diff: True
molecule:
testinfra_dir: tests
ansible_config_template: ansible.cfg
vagrant:
providers:
- name: virtualbox
type: virtualbox
platforms:
- name: openbsd
box: kaorimatz/openbsd-5.9-amd64
instances:
- name: ansible-role-example
options:
append_platform_to_hostname: yes
raw_config_args:
- 'vm.synced_folder ".", "/vagrant", disabled: true'
- 'vbguest.auto_update = false'
- 'landrush.enabled = false'
- 'landrush_ip.override = false'
---
# tasks file for ansible-mysql
# tasks file for ansible-role-mysql
- assert:
that:
- ansible_os_family == 'OpenBSD'
- ansible_distribution_release == '5.9'
- name: apt install
apt:
......
---
- hosts: all
gather_facts: false
roles:
- role: ansible-role-example
def test_example(Command):
assert Command('uname').rc == 0
def test_root(Command, Sudo):
with Sudo():
assert Command('whoami').stdout == 'root'
---
# vars file for ansible-mysql
# vars file for ansible-role-mysql
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment