Created
April 4, 2017 20:45
-
-
Save rob-gordon/3e2e8a9e81b9e9e5061dcd3f032542f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - hosts: all | |
| become: true | |
| tasks: | |
| - name: set hostname | |
| command: hostnamectl set-hostname {{sitetitle}}.local | |
| - name: restart hostname | |
| command: systemctl restart systemd-logind.service | |
| - name: set timezone to America/New_York | |
| copy: content="America/New_York" dest=/etc/timezone owner=root group=root mode=644 | |
| - command: dpkg-reconfigure --frontend noninteractive tzdata | |
| - name: install curl, git, software-properties-common, vim | |
| apt: name={{ item }} state=latest | |
| with_items: | |
| - curl | |
| - git | |
| - software-properties-common | |
| - vim | |
| # Apache | |
| - name: install apache | |
| apt: name=apache2 state=present | |
| - name: apache is running | |
| action: service name=apache2 state=started enabled=true | |
| - file: src=/etc/apache2/mods-available/rewrite.load dest=/etc/apache2/mods-enabled/rewrite.load state=link | |
| notify: restart apache | |
| - file: src=/etc/apache2/mods-available/headers.load dest=/etc/apache2/mods-enabled/headers.load state=link | |
| notify: restart apache | |
| - command: /bin/sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf | |
| notify: restart apache | |
| - copy: src=/var/www/000-default.conf dest=/etc/apache2/sites-available | |
| notify: restart apache | |
| - command: /usr/sbin/a2enmod ssl | |
| notify: restart apache | |
| - command: /usr/sbin/a2enmod proxy_html | |
| notify: restart apache | |
| # MySQL | |
| - name: install mysql | |
| apt: name={{ item }} state=latest | |
| with_items: | |
| - mysql-server | |
| - mysql-client | |
| - python-mysqldb | |
| - name: add wordpress mysql user | |
| mysql_user: name=wordpress | |
| host='%' | |
| password=wordpress priv=*.*:ALL,GRANT | |
| login_user=root | |
| login_password= | |
| - name: create wordpress database | |
| mysql_db: name=wordpress state=present | |
| - command: /bin/sed -i "s/bind-address.*=.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf | |
| notify: restart mysql | |
| - name: add PHP Repository | |
| apt_repository: repo='ppa:ondrej/php' | |
| - name: install php{{php_version}} and requisite modules | |
| apt: name={{ item }} state=latest | |
| with_items: | |
| - php{{php_version}} | |
| - php{{php_version}}-cli | |
| - php{{php_version}}-curl | |
| - php{{php_version}}-phpdbg | |
| #- php{{php_version}}-exactimage | |
| - php{{php_version}}-gd | |
| - php{{php_version}}-geoip | |
| - php{{php_version}}-gmp | |
| - php{{php_version}}-imagick | |
| - php{{php_version}}-imap | |
| - php{{php_version}}-intl | |
| - php{{php_version}}-json | |
| #- php{{php_version}}-lasso | |
| - php{{php_version}}-ldap | |
| - php{{php_version}}-mcrypt | |
| - php{{php_version}}-memcache | |
| - php{{php_version}}-memcached | |
| #- php{{php_version}}-mhash | |
| - php{{php_version}}-mysql | |
| - php{{php_version}}-oauth | |
| - php{{php_version}}-pspell | |
| - php{{php_version}}-radius | |
| - php{{php_version}}-readline | |
| - php{{php_version}}-redis | |
| #- php{{php_version}}-sasl | |
| - php{{php_version}}-stomp | |
| - php{{php_version}}-sybase | |
| - php{{php_version}}-tidy | |
| - php{{php_version}}-uuid | |
| - php{{php_version}}-xmlrpc | |
| - php{{php_version}}-xsl | |
| - php{{php_version}}-dev | |
| - php-pear | |
| - php{{php_version}}-xdebug | |
| - command: /bin/sed -i "s/;date.timezone =.*/date.timezone = America\/New_York/" /etc/php/{{php_version}}/apache2/php.ini | |
| - command: /bin/sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/{{php_version}}/apache2/php.ini | |
| - command: /bin/sed -i "s/display_errors = .*/display_errors = On/" /etc/php/{{php_version}}/apache2/php.ini | |
| - command: /bin/sed -i "s/post_max_size = .*/post_max_size = 400M/" /etc/php/{{php_version}}/apache2/php.ini | |
| - command: /bin/sed -i "s/upload_max_filesize = .*/upload_max_filesize = 400M/" /etc/php/{{php_version}}/apache2/php.ini | |
| - command: /bin/sed -i "s/;date.timezone =.*/date.timezone = America\/New_York/" /etc/php/{{php_version}}/cli/php.ini | |
| - command: /bin/sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/{{php_version}}/cli/php.ini | |
| - command: /bin/sed -i "s/display_errors = .*/display_errors = On/" /etc/php/{{php_version}}/cli/php.ini | |
| - command: /bin/sed -i "s/;\s*tds version =.*/tds version = 8.0/" /etc/freetds/freetds.conf | |
| # - copy: src=/var/www/tctmd/resources/vagrant/xdebug.ini dest=/etc/php/{{php_version}}/mods-available | |
| # notify: restart apache | |
| # composer | |
| - name: install composer | |
| get_url: | |
| url: https://getcomposer.org/composer.phar | |
| validate_certs: no | |
| dest: /usr/local/bin/composer | |
| mode: 0755 | |
| # READY! | |
| - debug: msg="Now ready at http://{{sitetitle}}.local - you will want to alias the VM IP addess to {{sitetitle}}.local in your /etc/hosts file." | |
| # handlers | |
| handlers: | |
| - name: restart apache | |
| action: service name=apache2 state=restarted | |
| - name: restart mysql | |
| action: service name=mysql state=restarted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment