Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service: Mysql #11

Closed
simbora opened this issue Aug 19, 2014 · 9 comments
Closed

Service: Mysql #11

simbora opened this issue Aug 19, 2014 · 9 comments

Comments

@simbora
Copy link
Owner

simbora commented Aug 19, 2014

Install

apt-get install mysql-server

Use a password for root from ENV['mysql_root_passwd'].

mysql_secure_installation

OBS: the above is interactive. Can we automate that using default answers?

Update /etc/mysql/my.cnf

- datadir = /var/lib/mysql
+ datadir = /data/mysql
@simbora simbora changed the title Module: Mysql Service: Mysql Aug 19, 2014
@rxaviers rxaviers added this to the Services deployment milestone Aug 19, 2014
@dzydzany
Copy link
Collaborator

dzydzany commented Nov 1, 2014

Password will be set only during first ansible run. On other runs it will fail and will be ignored.

Question:
Environment variable on remote (provisioned) host or locally from your computer?

@rxaviers
Copy link
Collaborator

rxaviers commented Nov 1, 2014

On Saturday, November 1, 2014, dzydzany [email protected] wrote:

Password will be set only during first ansible run. On other runs it will
fail and will be ignored

Ok

Question:
Environment variable on remote (provisioned) host or locally from your
computer?

Local computer please


Reply to this email directly or view it on GitHub
#11 (comment).

+55 (16) 98138-1582, +1 (415) 568-5854, skype: rxaviers
http://rafael.xavier.blog.br

@dzydzany
Copy link
Collaborator

dzydzany commented Nov 1, 2014

All done, please test.

@rxaviers
Copy link
Collaborator

I ran it. But, it fails.

$ mysql_root_password=<passwd> ansible-playbook -i hosts site.yml --user root --ask-pass
...
NOTIFIED: [Restart apparmor service] ****************************************** 
failed: [morpheus] => {"failed": true, "item": ""}
msg: service not found: apparmor

FATAL: all hosts have already failed -- aborting

Please, create PRs for each issue you implement.

@dzydzany
Copy link
Collaborator

As AppArmor is installed and enabled in almost every Ubuntu installation, I've put a check, so if it is installed, reconfigure it, if not, do nothing.

AppArmor in Ubuntu:
https://wiki.ubuntu.com/AppArmor

@rxaviers
Copy link
Collaborator

After your update, AppArmor is getting skipped just fine.

@rxaviers
Copy link
Collaborator

On mysql installation, it should require the password environment variable to be set otherwise to abort.
On mysql already installed, it should not require it, therefore it should ignore in case it's not set.

Can that be implemented?

@dzydzany
Copy link
Collaborator

Currently it works this way: If you enter password as environemnt variable, it set it during run, if you forgot to create variable, it wont setup password. If you run ansible again and enter variable, and pasword is not set up, it will set it during that second run. I can try to check if variable is defined, and abort or ask for password if you wish.

@rxaviers
Copy link
Collaborator

The way you described it currently works is great.

@dzydzany dzydzany mentioned this issue Dec 3, 2014
rxaviers added a commit that referenced this issue Dec 3, 2014
rxaviers added a commit that referenced this issue Dec 3, 2014
dzydzany added a commit that referenced this issue Apr 8, 2015
- Install MySL server and set password for root user from local
  environment variable.
- Continue ansible run if mysql_user fails. Password is already
  configured at first run.
- Remove debuging from mysql playbook and rename mysql password setup
  task.
- Change mysql data folder setting, move mysql data folder and restart
  required service.
- Cheack if apparmor is installed and reconfigure if it does.
- Move mysql playbook to webservers section.
- Change password variable to mysql_root_passwd.

Fixes #11
Closes #35
rxaviers added a commit that referenced this issue Apr 8, 2015
rxaviers added a commit that referenced this issue Apr 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants