Skip to content

Instantly share code, notes, and snippets.

@aeosys
Last active July 9, 2017 17:14

Revisions

  1. aeosys revised this gist Jul 9, 2017. 1 changed file with 30 additions and 11 deletions.
    41 changes: 30 additions & 11 deletions playbook.yml
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,26 @@
    ---
    - hosts: all
    become: true
    vars:
    apache_config_file: symfony.apache.conf
    tasks:
    - name: Ensure apt has updated cache
    # Packages
    - name: Update apt cache
    apt: update_cache=yes

    - name: Install https transport
    apt:
    name: apt-transport-https
    state: present
    update_cache: yes

    - apt_key:
    url: https://www.dotdeb.org/dotdeb.gpg
    - name: Add repository key for PHP7.1
    apt_key:
    url: https://packages.sury.org/php/apt.gpg
    state: present

    - apt_repository: repo={{ item }} state=present update_cache=yes
    - name: Add repository for PHP7.1
    apt_repository: repo={{ item }} state=present update_cache=yes
    with_items:
    - deb https://packages.sury.org/php/ jessie main

    @@ -33,12 +39,14 @@
    - restart apache2

    - name: Move Apache configuration to quest
    copy: src=symfony.apache.conf dest=/etc/apache2/sites-available/symfony.conf
    copy: src="{{ apache_config_file }}" dest=/etc/apache2/sites-available/dev-site.conf
    notify:
    - restart apache2

    - name: Apply Apache configuration
    command: a2ensite symfony
    command: a2ensite dev-site
    args:
    creates: /etc/apache2/sites-enabled/symfony.conf
    creates: /etc/apache2/sites-enabled/dev-site.conf
    notify:
    - restart apache2

    @@ -49,15 +57,20 @@
    notify:
    - restart apache2

    - name: Create db for symfony
    mysql_db: name=symfony state=present
    - name: Create db for site
    mysql_db: name=site state=present

    - name: Create site folder
    file: path=/home/vagrant/site state=directory mode=0775
    become: true
    become_user: vagrant

    - name: Link www to home folder
    file: src=/home/vagrant/site path=/var/www/symfony state=link force=yes
    file: src=/home/vagrant/site path=/var/www/site state=link force=yes

    # PHP
    - name: Install PHP7.1
    apt: name={{ item }} state=latest allow_unauthenticated=yes
    apt: name={{ item }} state=latest
    with_items:
    - php7.1
    - php7.1-bz2
    @@ -75,6 +88,12 @@
    - php7.1-xml
    - php7.1-zip

    # Composer
    - name: Install composer
    shell: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
    args:
    creates: /usr/local/bin/composer

    handlers:
    - name: restart apache2
    service: name=apache2 state=restarted
  2. aeosys revised this gist Jul 4, 2017. 1 changed file with 27 additions and 28 deletions.
    55 changes: 27 additions & 28 deletions playbook.yml
    Original file line number Diff line number Diff line change
    @@ -2,17 +2,21 @@
    - hosts: all
    become: true
    tasks:
    - apt_repository: repo={{ item }} state=present
    with_items:
    - deb http://packages.dotdeb.org jessie all
    - deb-src http://packages.dotdeb.org jessie all
    - name: Ensure apt has updated cache
    apt: update_cache=yes

    - name: Install https transport
    apt:
    name: apt-transport-https
    state: present

    - apt_key:
    url: https://www.dotdeb.org/dotdeb.gpg
    state: present

    - name: Ensure apt has updated cache
    apt: update_cache=yes
    - apt_repository: repo={{ item }} state=present update_cache=yes
    with_items:
    - deb https://packages.sury.org/php/ jessie main

    - name: Install packages
    apt: name={{ item }} state=latest
    @@ -52,29 +56,24 @@
    file: src=/home/vagrant/site path=/var/www/symfony state=link force=yes

    # PHP
    - name: Install PHP7
    apt: name={{ item }} state=latest
    - name: Install PHP7.1
    apt: name={{ item }} state=latest allow_unauthenticated=yes
    with_items:
    - php7.0
    - php7.0-apcu
    - php7.0-bz2
    - php7.0-curl
    - php7.0-cli
    - php7.0-dba
    - php7.0-dbg
    - php7.0-imap
    - php7.0-intl
    - php7.0-json
    - php7.0-mbstring
    - php7.0-mcrypt
    - php7.0-memcached
    - php7.0-mysql
    - php7.0-odbc
    - php7.0-soap
    - php7.0-ssh2
    - php7.0-xdebug
    - php7.0-xml
    - php7.0-zip
    - php7.1
    - php7.1-bz2
    - php7.1-curl
    - php7.1-cli
    - php7.1-dba
    - php7.1-imap
    - php7.1-intl
    - php7.1-json
    - php7.1-mbstring
    - php7.1-mcrypt
    - php7.1-mysql
    - php7.1-odbc
    - php7.1-soap
    - php7.1-xml
    - php7.1-zip

    handlers:
    - name: restart apache2
  3. aeosys revised this gist Jun 28, 2017. 1 changed file with 40 additions and 0 deletions.
    40 changes: 40 additions & 0 deletions symfony.apache.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    <VirtualHost *:80>
    ServerName devel.tld
    ServerAlias www.devel.tld

    DocumentRoot /var/www/symfony/web
    <Directory /var/www/symfony/web>
    AllowOverride None
    Require all granted
    Allow from All

    <IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]

    # Authentication headers
    RewriteCond %{HTTP:Authorization} ^(.*)
    RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
    </IfModule>
    </Directory>

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeeScript assets
    <Directory /var/www/symfony>
    Options FollowSymlinks
    </Directory>

    # optionally disable the RewriteEngine for the asset directories
    # which will allow apache to simply reply with a 404 when files are
    # not found instead of passing the request into the full symfony stack
    <Directory /var/www/symfony/web/bundles>
    <IfModule mod_rewrite.c>
    RewriteEngine Off
    </IfModule>
    </Directory>

    ErrorLog /var/log/apache2/symfony_error.log
    CustomLog /var/log/apache2/symfony_access.log combined
    </VirtualHost>
  4. aeosys revised this gist Jun 28, 2017. 1 changed file with 31 additions and 0 deletions.
    31 changes: 31 additions & 0 deletions playbook.yml
    Original file line number Diff line number Diff line change
    @@ -22,9 +22,36 @@
    - mariadb-server
    - python-mysqldb

    # Apache
    - name: Enabled mod_rewrite
    apache2_module: name=rewrite state=present
    notify:
    - restart apache2

    - name: Move Apache configuration to quest
    copy: src=symfony.apache.conf dest=/etc/apache2/sites-available/symfony.conf

    - name: Apply Apache configuration
    command: a2ensite symfony
    args:
    creates: /etc/apache2/sites-enabled/symfony.conf
    notify:
    - restart apache2

    - name: Disable default Apache configuration
    command: a2dissite 000-default
    args:
    removes: /etc/apache2/sites-enabled/000-default.conf
    notify:
    - restart apache2

    - name: Create db for symfony
    mysql_db: name=symfony state=present

    - name: Link www to home folder
    file: src=/home/vagrant/site path=/var/www/symfony state=link force=yes

    # PHP
    - name: Install PHP7
    apt: name={{ item }} state=latest
    with_items:
    @@ -48,3 +75,7 @@
    - php7.0-xdebug
    - php7.0-xml
    - php7.0-zip

    handlers:
    - name: restart apache2
    service: name=apache2 state=restarted
  5. aeosys revised this gist Jun 27, 2017. 1 changed file with 40 additions and 30 deletions.
    70 changes: 40 additions & 30 deletions playbook.yml
    Original file line number Diff line number Diff line change
    @@ -1,40 +1,50 @@
    # Incomplete

    mariadb-server
    apache2
    git

    php7:
    $ sudo -s
    # echo 'deb http://packages.dotdeb.org jessie all' >> /etc/apt/sources.list
    # echo 'deb-src http://packages.dotdeb.org jessie all' >> /etc/apt/sources.list

    wget https://www.dotdeb.org/dotdeb.gpg
    sudo apt-key add dotdeb.gpg

    apt-get install php7-*

    poistettu php70-snmp


    ---
    - hosts: all
    become: true
    tasks:
    - apt_repository:
    repo: deb http://packages.dotdeb.org jessie all
    state: present

    - apt_repository:
    repo: deb-src http://packages.dotdeb.org jessie all
    state: present
    - apt_repository: repo={{ item }} state=present
    with_items:
    - deb http://packages.dotdeb.org jessie all
    - deb-src http://packages.dotdeb.org jessie all

    - apt_key:
    url: https://www.dotdeb.org/dotdeb.gpg
    state: present
    url: https://www.dotdeb.org/dotdeb.gpg
    state: present

    - name: Ensure apt has updated cache
    apt: update_cache=yes

    - name: Ensure Apache2 is installed
    apt: name=apache2 state=present
    - name: Install packages
    apt: name={{ item }} state=latest
    with_items:
    - git
    - apache2
    - mariadb-server
    - python-mysqldb

    - name: Create db for symfony
    mysql_db: name=symfony state=present

    - name: Install PHP7
    apt: name={{ item }} state=latest
    with_items:
    - php7.0
    - php7.0-apcu
    - php7.0-bz2
    - php7.0-curl
    - php7.0-cli
    - php7.0-dba
    - php7.0-dbg
    - php7.0-imap
    - php7.0-intl
    - php7.0-json
    - php7.0-mbstring
    - php7.0-mcrypt
    - php7.0-memcached
    - php7.0-mysql
    - php7.0-odbc
    - php7.0-soap
    - php7.0-ssh2
    - php7.0-xdebug
    - php7.0-xml
    - php7.0-zip
  6. aeosys created this gist Jun 26, 2017.
    40 changes: 40 additions & 0 deletions playbook.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    # Incomplete

    mariadb-server
    apache2
    git

    php7:
    $ sudo -s
    # echo 'deb http://packages.dotdeb.org jessie all' >> /etc/apt/sources.list
    # echo 'deb-src http://packages.dotdeb.org jessie all' >> /etc/apt/sources.list

    wget https://www.dotdeb.org/dotdeb.gpg
    sudo apt-key add dotdeb.gpg

    apt-get install php7-*

    poistettu php70-snmp


    ---
    - hosts: all
    become: true
    tasks:
    - apt_repository:
    repo: deb http://packages.dotdeb.org jessie all
    state: present

    - apt_repository:
    repo: deb-src http://packages.dotdeb.org jessie all
    state: present

    - apt_key:
    url: https://www.dotdeb.org/dotdeb.gpg
    state: present

    - name: Ensure apt has updated cache
    apt: update_cache=yes

    - name: Ensure Apache2 is installed
    apt: name=apache2 state=present