Advertisement
Guest User

Untitled

a guest
Oct 6th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.74 KB | None | 0 0
  1. ---
  2. - hosts: all
  3. sudo: true
  4. tasks:
  5.  
  6. - name: create /var/www
  7. file: path=/var/www state=directory
  8.  
  9. - name: create site symlink
  10. file: src=/vagrant/htdocs dest=/var/www/site state=link
  11. notify: restart apache
  12.  
  13. - name: install misc packages
  14. apt: name={{ item }} state=latest
  15. with_items:
  16. - rubygems
  17. - git-core
  18. - curl
  19. - unzip
  20. - vim
  21.  
  22. - name: install language packs for locale support
  23. apt: name={{ item }} state=latest
  24. with_items:
  25. - language-pack-de-base
  26. - language-pack-es-base
  27.  
  28. # memcached
  29.  
  30. - name: ensure memcached is installed
  31. apt: name=memcached state=latest
  32.  
  33.  
  34. # beanstalk
  35.  
  36. - name: install beanstalk for local queues
  37. apt: name=beanstalkd state=present
  38. - name: set up beanstalk
  39. copy: src=/vagrant/ansible/templates/beanstalkd dest=/etc/default/beanstalkd
  40. notify: restart beanstalkd
  41.  
  42. # Apache2
  43.  
  44. - name: ensure apache is installed
  45. apt: name=apache2 state=present
  46.  
  47. - name: make sure apache is running
  48. action: service name=apache2 state=started enabled=true
  49.  
  50. - file: src=/etc/apache2/mods-available/rewrite.load dest=/etc/apache2/mods-enabled/rewrite.load state=link
  51. notify: restart apache
  52.  
  53. - file: src=/etc/apache2/mods-available/headers.load dest=/etc/apache2/mods-enabled/headers.load state=link
  54. notify: restart apache
  55.  
  56. - copy: src=/vagrant/ansible/templates/site.conf dest=/etc/apache2/sites-enabled/site.conf
  57. notify: restart apache
  58.  
  59. - file: path=/etc/apache2/sites-enabled/000-default.conf state=absent
  60. notify: restart apache
  61.  
  62. - file: path=/etc/apache2/conf.d state=directory
  63.  
  64. - copy: src=/vagrant/ansible/templates/fqdn.conf dest=/etc/apache2/conf.d/fqdn.conf
  65. notify: restart apache
  66.  
  67. - copy: src=/vagrant/ansible/templates/nosendfile.conf dest=/etc/apache2/conf.d/nosendfile.conf
  68. notify: restart apache
  69.  
  70. # MySQL
  71.  
  72. - name: install MySQL
  73. apt: name={{ item }} state=latest
  74. with_items:
  75. - mysql-server
  76. - mysql-client
  77. - python-mysqldb
  78.  
  79. - name: add mysql user
  80. mysql_user: name=vagrant
  81. host={{ item }}
  82. password=vagrant priv=*.*:ALL,GRANT
  83. login_user=root
  84. login_password=
  85. with_items:
  86. - '%'
  87. - localhost
  88.  
  89. - name: create mysql databases
  90. mysql_db: name={{ item }}
  91. state=present
  92. with_items:
  93. - site_development
  94. - site_development_stats
  95. - site_testing
  96. - site_testing_stats
  97.  
  98. - file: path=/etc/mysql/conf.d state=directory
  99. - name: Set MySQL number of connections
  100. copy: src=/vagrant/ansible/templates/max_connections.cnf dest=/etc/mysql/conf.d/max_connections.cnf
  101. notify: restart mysql
  102. - name: Install mysql command line client configuration file
  103. copy: src=/vagrant/ansible/templates/my.cnf dest=/home/vagrant/.my.cnf owner=vagrant group=vagrant
  104.  
  105. # PHP
  106.  
  107. - name: add php5 ppa
  108. apt_repository: repo='ppa:ondrej/php5'
  109.  
  110. - name: install PHP5 packages
  111. apt: name={{ item }} state=latest
  112. with_items:
  113. - php5
  114. - libapache2-mod-php5
  115. - php5-cli
  116. - php5-dev
  117. - php5-mysql
  118. - php-pear
  119. - php5-mcrypt
  120. - php5-gd
  121. - php5-curl
  122. - php5-xdebug
  123. - php5-memcache
  124. - php5-memcached
  125. - php5-readline
  126. - php5-sqlite
  127.  
  128. - file: path=/etc/php5/conf.d state=directory
  129.  
  130. - copy: src=/vagrant/ansible/templates/php-site.ini dest=/etc/php5/conf.d/php-site.ini
  131. notify: restart apache
  132.  
  133. - name: symlink common php configuration for cli handler
  134. file: src=/etc/php5/conf.d/php-site.ini dest=/etc/php5/cli/conf.d/php-site.ini state=link
  135. notify: restart apache
  136.  
  137. - name: symlink common php configuration for apache2 handler
  138. file: src=/etc/php5/conf.d/php-site.ini dest=/etc/php5/apache2/conf.d/php-site.ini state=link
  139. notify: restart apache
  140.  
  141. # phpmyadmin
  142.  
  143. - name: install phpmyadmin
  144. apt: name=phpmyadmin state=latest
  145.  
  146. # Assets compilation
  147.  
  148. - name: add nodejs ppa
  149. apt_repository: repo='ppa:chris-lea/node.js'
  150.  
  151. - name: install nodejs
  152. apt: name=nodejs state=latest
  153.  
  154. - name: install rubygems
  155. apt: name=rubygems state=present
  156.  
  157. - name: install compass
  158. command: gem install compass sass chunky_png fssm creates=/usr/local/bin/compass
  159.  
  160. # Set up site
  161. #
  162.  
  163. - file: src=/vagrant dest=/var/www/site state=link
  164. - file: path={{ item }} owner=vagrant group=vagrant mode=0777 state=directory
  165. with_items:
  166. - /var/cache/site
  167. - /var/cache/site/cache
  168. - /var/cache/site/clockwork
  169. - /var/cache/site/logs
  170. - /var/cache/site/meta
  171. - /var/cache/site/sessions
  172. - /var/cache/site/views
  173.  
  174. - name: ensure once more that 000-default.conf is deleted
  175. file: path=/etc/apache2/sites-enabled/000-default.conf state=absent
  176. notify: restart apache
  177.  
  178. - name: ensure that phpmyadmin's stock config is deleted
  179. file: path=/etc/apache2/conf.d/phpmyadmin.conf state=absent
  180.  
  181. # - name: install npm packages
  182. # command: chdir=/var/www/site npm install --no-bin-links
  183. # register: out
  184. # changed_when: "out.stdout.strip() != ''"
  185. # sudo: false
  186.  
  187. # - name: install composer packages
  188. # command: chdir=/var/www/site bash pocket install
  189. # register: out
  190. # changed_when: "'Nothing to install or update' not in out.stdout"
  191. # sudo: false
  192.  
  193. # - name: set up artisan queue listen
  194. # copy: src=/vagrant/ansible/templates/supervisor-queue-listen.conf dest=/etc/supervisor/conf.d/supervisor-queue-listen.conf
  195. # notify: reload queue listener
  196.  
  197. # Common stuff
  198.  
  199. handlers:
  200. - name: restart apache
  201. action: service name=apache2 state=restarted
  202. - name: restart mysql
  203. action: service name=mysql state=restarted
  204. # - name: reload queue listener
  205. # action: supervisorctl name=queue_listen state=restarted
  206. - name: restart beanstalkd
  207. action: service name=beanstalkd state=restarted
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement