ansible-playbooks/README.md

57 lines
1.5 KiB
Markdown
Raw Normal View History

2013-09-26 11:05:05 +00:00
My Ansible Playbooks
2013-09-26 11:02:30 +00:00
=================
2013-09-26 11:05:05 +00:00
This is just my repository of playbooks.
* create-user.yml
* Creates a user with a password, a MySql DB, and an Apache virtual host.
2013-09-26 11:02:30 +00:00
### Setup Ansible
2013-09-26 11:50:57 +00:00
sudo aptitude -y install git python-jinja2 python-yaml python-mysqldb python-paramiko python-software-properties software-properties-common
2013-09-26 11:02:30 +00:00
add-apt-repository ppa:rquillo/ansible
aptitude update && aptitude install ansible
echo "localhost" > /etc/ansible/hosts
You can now test by typing:
2014-02-07 00:43:21 +00:00
ansible -c local -m ping all
2013-09-26 11:02:30 +00:00
You should see:
2013-09-26 11:10:57 +00:00
localhost | success >> {
"changed": false,
"ping": "pong"
}
2013-09-26 11:16:09 +00:00
### Install passlib (for create-user.yml)
wget https://passlib.googlecode.com/files/passlib-1.6.1.tar.gz
tar -zxvf passlib-1.6.1.tar.gz
cd passlib-1.6.1
python setup.py install
2013-09-26 11:50:57 +00:00
### Check my.cnf
2014-02-07 00:34:29 +00:00
You may need to set up a ~/.my.cnf file for the user you'll run this as (you'll probably need the user specified in the file, not just the password!):
2013-09-26 11:50:57 +00:00
[client]
user=root
password="mypassword"
2013-09-26 11:10:42 +00:00
2013-09-26 11:02:30 +00:00
### Run the play
By executing the following, it will setup only the commonly used components:
2014-02-07 00:43:21 +00:00
ansible-playbook -c local --tags="common,mysql,apache,file" ./create-user.yml
2013-09-26 11:02:30 +00:00
You can also just run the run-all script.
2014-03-12 20:24:13 +00:00
### For Wordpress
2014-03-12 20:35:56 +00:00
chmod 775 -R /home/$user/public_html
chown :www-data -R /home/$user/public_html
usermod -G www-data $user
echo "umask 002" >> /etc/apache2/envvars
echo "define( 'FS_METHOD', 'direct' );" >> /home/$user/public_html/wp-config.php