From 8640e7d6e61123e55e4571d97b5ef74758bd7698 Mon Sep 17 00:00:00 2001 From: UM-JG Date: Thu, 8 Oct 2015 15:25:44 +0200 Subject: [PATCH 1/9] Test Role --- ansible/roles/phpmyadmin/README.md | 21 +++++++ ansible/roles/phpmyadmin/tasks/install.yml | 62 +++++++++++++++++++ ansible/roles/phpmyadmin/tasks/main.yml | 3 + ansible/roles/phpmyadmin/tasks/pma-apache.yml | 11 ++++ ansible/roles/phpmyadmin/tasks/pma-nginx.yml | 16 +++++ .../phpmyadmin/templates/nginx-phpmyadmin.tpl | 38 ++++++++++++ .../phpmyadmin/templates/phpmyadmin.conf.tpl | 47 ++++++++++++++ 7 files changed, 198 insertions(+) create mode 100755 ansible/roles/phpmyadmin/README.md create mode 100755 ansible/roles/phpmyadmin/tasks/install.yml create mode 100755 ansible/roles/phpmyadmin/tasks/main.yml create mode 100755 ansible/roles/phpmyadmin/tasks/pma-apache.yml create mode 100755 ansible/roles/phpmyadmin/tasks/pma-nginx.yml create mode 100755 ansible/roles/phpmyadmin/templates/nginx-phpmyadmin.tpl create mode 100755 ansible/roles/phpmyadmin/templates/phpmyadmin.conf.tpl diff --git a/ansible/roles/phpmyadmin/README.md b/ansible/roles/phpmyadmin/README.md new file mode 100755 index 0000000..5098513 --- /dev/null +++ b/ansible/roles/phpmyadmin/README.md @@ -0,0 +1,21 @@ +PHPMYADMIN +================ + +##Instructions +If you want to use phpmyadmin on your vagrant box, you need to setup a hostname for your application. +You also need to choose a hostname for your phpmyadmin installation in that vagrant box. +And you need to add that both those hostname in your hosts file (/etc/hosts). + +You now only need to add those variable into your playbook.yml or +into a specific vars file depending on your liking. + +```yaml +phpmyadmin: + - + user: mysql user + pass: mysql password + hostname: phpmyadmin hostname + pma_dbname: phpmyadmin database name +``` + +Enjoy diff --git a/ansible/roles/phpmyadmin/tasks/install.yml b/ansible/roles/phpmyadmin/tasks/install.yml new file mode 100755 index 0000000..bc58315 --- /dev/null +++ b/ansible/roles/phpmyadmin/tasks/install.yml @@ -0,0 +1,62 @@ +--- +- name: Add phpmyadmin ppa Repository + sudo: yes + apt_repository: repo=ppa:nijel/phpmyadmin + +- name: Update apt + sudo: yes + apt: update_cache=yes + +- name: install pma + sudo: yes + apt: pkg=phpmyadmin state=present + +- name: configure phpmyadmin for apache + include: pma-apache.yml + when: apache.install=='apachephp' + +#- name: configure phpmyadmin for nginx +# include: pma-nginx.yml +# when: web_server=='nginxphp'# + +#- name: configure phpmyadmin for nginx +# include: pma-nginx.yml +# when: web_server=='nginxhhvm' + +- name: Add phpmyadmin.vb1 to the /etc/hosts file + lineinfile: dest=/etc/hosts line='127.0.0.1 {{ item.hostname }}' state=present + with_items: phpmyadmin + +- name: Configure phpmyadmin database user + lineinfile: dest=/etc/phpmyadmin/config-db.php + regexp="dbuser=" + line="$dbuser='{{ item.user }}';" + state=present + with_items: phpmyadmin + +- name: Configure phpmyadmin database password + lineinfile: dest=/etc/phpmyadmin/config-db.php + regexp="dbpass=" + line="$dbpass='{{ item.pass }}';" + state=present + with_items: phpmyadmin + +- name: Configure phpmyadmin database database name + lineinfile: dest=/etc/phpmyadmin/config-db.php + regexp="dbname=" + line="$dbname='{{ item.pma_dbname }}';" + state=present + with_items: phpmyadmin + +- name: Create the phpmyadmin database + sudo: yes + mysql_db: name={{ item.pma_dbname }} state=present + with_items: phpmyadmin + +- name: create the phpmyadmin user + mysql_user: name={{ item.user }} password={{ item.pass }} priv={{ item.pma_dbname }}.*:ALL state=present host='%' + with_items: phpmyadmin + +- name: setup the phpmyadmin db + shell: mysql -u{{ item.user }} -p{{ item.pass }} {{ item.pma_dbname }} < /usr/share/dbconfig-common/data/phpmyadmin/install/mysql + with_items: phpmyadmin diff --git a/ansible/roles/phpmyadmin/tasks/main.yml b/ansible/roles/phpmyadmin/tasks/main.yml new file mode 100755 index 0000000..6e61a18 --- /dev/null +++ b/ansible/roles/phpmyadmin/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include: install.yml + when: mysql.install diff --git a/ansible/roles/phpmyadmin/tasks/pma-apache.yml b/ansible/roles/phpmyadmin/tasks/pma-apache.yml new file mode 100755 index 0000000..98ee9c3 --- /dev/null +++ b/ansible/roles/phpmyadmin/tasks/pma-apache.yml @@ -0,0 +1,11 @@ +- name: configure phpmyadmin for apache + file: path=/var/www/phpmyadmin src=/usr/share/phpmyadmin state=link + +- name: configure phpmyadmin for apache + template: src=phpmyadmin.conf.tpl dest=/etc/apache2/conf-available/phpmyadmin.conf + with_items: phpmyadmin + +- name: configure phpmyadmin for apache + notify: restart apache + sudo: yes + command: a2enconf phpmyadmin \ No newline at end of file diff --git a/ansible/roles/phpmyadmin/tasks/pma-nginx.yml b/ansible/roles/phpmyadmin/tasks/pma-nginx.yml new file mode 100755 index 0000000..0651f00 --- /dev/null +++ b/ansible/roles/phpmyadmin/tasks/pma-nginx.yml @@ -0,0 +1,16 @@ +- name: Create the folder for the phpmyadmin installation + sudo: yes + file: path=/usr/share/nginx/www state=directory + +- name: configure phpmyadmin for nginx + sudo: yes + file: path=/usr/share/nginx/www/phpmyadmin src=/usr/share/phpmyadmin state=link + +- name: configuration of phpmyadmin in sites-available for nginx + template: src=nginx-phpmyadmin.tpl dest=/etc/nginx/sites-available/phpmyadmin + with_items: phpmyadmin + +- name: enabling phpmyadmin for nginx + sudo: yes + file: path=/etc/nginx/sites-enabled/phpmyadmin src=/etc/nginx/sites-available/phpmyadmin state=link + notify: restart nginx \ No newline at end of file diff --git a/ansible/roles/phpmyadmin/templates/nginx-phpmyadmin.tpl b/ansible/roles/phpmyadmin/templates/nginx-phpmyadmin.tpl new file mode 100755 index 0000000..19f8838 --- /dev/null +++ b/ansible/roles/phpmyadmin/templates/nginx-phpmyadmin.tpl @@ -0,0 +1,38 @@ +server { + listen 80; + server_name {{ item.hostname }}; + access_log /var/log/phpmyadminaccess.log; + error_log /var/log/phpmyadminierror.log; + root /usr/share/nginx/www/phpmyadmin; + + location / { + index index.php; + } + + ## Images and static content is treated different + location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { + access_log off; + expires 360d; + } + + location ~ /\.ht { + deny all; + } + + location ~ /(libraries|setup/frames|setup/libs) { + deny all; + return 404; + } + + location ~ \.php$ { + include /etc/nginx/fastcgi_params; + fastcgi_pass unix:/var/run/php5-fpm.sock; + + #check your /etc/php5/fpm/pool.d/www.conf to see if fpm is listening on a socket or a port. + #;listen = /var/run/php5-fpm.sock + #listen = 127.0.0.1:9000 + + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME /usr/share/nginx/www/phpmyadmin$fastcgi_script_name; + } +} \ No newline at end of file diff --git a/ansible/roles/phpmyadmin/templates/phpmyadmin.conf.tpl b/ansible/roles/phpmyadmin/templates/phpmyadmin.conf.tpl new file mode 100755 index 0000000..7a9e5d7 --- /dev/null +++ b/ansible/roles/phpmyadmin/templates/phpmyadmin.conf.tpl @@ -0,0 +1,47 @@ +# phpMyAdmin default Apache configuration + +Alias /phpmyadmin /usr/share/phpmyadmin + + + Options FollowSymLinks + DirectoryIndex index.php + + + AddType application/x-httpd-php .php + + php_flag magic_quotes_gpc Off + php_flag track_vars On + php_flag register_globals Off + php_admin_flag allow_url_fopen Off + php_value include_path . + php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp + php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/ + + + + +# Authorize for setup + + + AuthType Basic + AuthName "phpMyAdmin Setup" + AuthUserFile /etc/phpmyadmin/htpasswd.setup + + Require valid-user + + +# Disallow web access to directories that don't need it + + Order Deny,Allow + Deny from All + + + Order Deny,Allow + Deny from All + + + + DocumentRoot /usr/share/phpmyadmin + ServerName {{ item.hostname }} + ServerAlias www.{{ item.hostname }} + \ No newline at end of file From c0612f6f3b877acaa992f0c35347a2c67dd8d273 Mon Sep 17 00:00:00 2001 From: UM-JG Date: Thu, 8 Oct 2015 17:07:51 +0200 Subject: [PATCH 2/9] role phpmyadmin, enable missing crypt php module --- ansible/roles/common/meta/main.yml | 1 + ansible/roles/php/tasks/install.yml | 5 + ansible/roles/phpmyadmin/defaults/main.yml | 6 ++ ansible/roles/phpmyadmin/meta/main.yml | 7 ++ ansible/roles/phpmyadmin/tasks/install.yml | 96 +++++++++---------- ansible/roles/phpmyadmin/tasks/main.yml | 2 +- ansible/roles/phpmyadmin/tasks/pma-apache.yml | 11 --- ansible/roles/phpmyadmin/tasks/pma-nginx.yml | 16 ---- .../phpmyadmin/templates/nginx-phpmyadmin.tpl | 38 -------- .../phpmyadmin/templates/phpmyadmin.conf.tpl | 47 --------- 10 files changed, 63 insertions(+), 166 deletions(-) create mode 100644 ansible/roles/phpmyadmin/defaults/main.yml create mode 100644 ansible/roles/phpmyadmin/meta/main.yml delete mode 100755 ansible/roles/phpmyadmin/tasks/pma-apache.yml delete mode 100755 ansible/roles/phpmyadmin/tasks/pma-nginx.yml delete mode 100755 ansible/roles/phpmyadmin/templates/nginx-phpmyadmin.tpl delete mode 100755 ansible/roles/phpmyadmin/templates/phpmyadmin.conf.tpl diff --git a/ansible/roles/common/meta/main.yml b/ansible/roles/common/meta/main.yml index 38dc562..c537e8f 100644 --- a/ansible/roles/common/meta/main.yml +++ b/ansible/roles/common/meta/main.yml @@ -6,4 +6,5 @@ dependencies: - php - xdebug - composer + - phpmyadmin - varnish diff --git a/ansible/roles/php/tasks/install.yml b/ansible/roles/php/tasks/install.yml index 58e2e45..c29a915 100644 --- a/ansible/roles/php/tasks/install.yml +++ b/ansible/roles/php/tasks/install.yml @@ -21,5 +21,10 @@ notify: - restart apache +- name: Enable mcrypt + sudo: yes + shell: php5enmod mcrypt + when: "'php5-mcrypt' in php.packages" + - include: configure.yml - include: pecl.yml diff --git a/ansible/roles/phpmyadmin/defaults/main.yml b/ansible/roles/phpmyadmin/defaults/main.yml new file mode 100644 index 0000000..9670a51 --- /dev/null +++ b/ansible/roles/phpmyadmin/defaults/main.yml @@ -0,0 +1,6 @@ +--- + +phpmyadmin: + dbname: phpmyadmin + dbuser: phpmyadmin + dbpass: phpmyadmin diff --git a/ansible/roles/phpmyadmin/meta/main.yml b/ansible/roles/phpmyadmin/meta/main.yml new file mode 100644 index 0000000..5817bee --- /dev/null +++ b/ansible/roles/phpmyadmin/meta/main.yml @@ -0,0 +1,7 @@ +--- +allow_duplicates: no + +dependencies: + - { role: apache } + - { role: php } + - { role: mysql } diff --git a/ansible/roles/phpmyadmin/tasks/install.yml b/ansible/roles/phpmyadmin/tasks/install.yml index bc58315..957512c 100755 --- a/ansible/roles/phpmyadmin/tasks/install.yml +++ b/ansible/roles/phpmyadmin/tasks/install.yml @@ -1,62 +1,52 @@ --- -- name: Add phpmyadmin ppa Repository +- name: debconf for pma dbconfig-install sudo: yes - apt_repository: repo=ppa:nijel/phpmyadmin + debconf: name=phpmyadmin question='phpmyadmin/dbconfig-install' value='true' vtype='boolean' -- name: Update apt +# MySQL-Datenbankname für phpmyadmin: +# phpmyadmin phpmyadmin/db/dbname string phpmyadmin +- name: debconf for pma dbname sudo: yes - apt: update_cache=yes + debconf: name=phpmyadmin question='phpmyadmin/db/dbname' value='{{phpmyadmin.dbname}}' vtype='string' + +# MySQL-Benutzername für phpmyadmin: +# phpmyadmin phpmyadmin/db/app-user string phpmyadmin +- name: debconf for pma app-user + sudo: yes + debconf: name=phpmyadmin question='phpmyadmin/db/app-user' value='{{phpmyadmin.dbuser}}' vtype='string' + +- name: debconf for pma app-pass + sudo: yes + debconf: name=phpmyadmin question='phpmyadmin/mysql/app-pass' value='{{phpmyadmin.dbpass}}' vtype='password' + + +# Verbindungsmethode an die MySQL-Datenbank von phpmyadmin: +# Choices: Unix-Socket, TCP/IP +# phpmyadmin phpmyadmin/mysql/method select unix socket + +- name: debconf for pma app-password-confirm + sudo: yes + debconf: name=phpmyadmin question='phpmyadmin/app-password-confirm' value='{{phpmyadmin.dbpass}}' vtype='password' + +# Name des administrativen Datenbank-Benutzers: +#phpmyadmin phpmyadmin/mysql/admin-user string root + +- name: debconf for pma admin-pass + sudo: yes + debconf: name=phpmyadmin question='phpmyadmin/mysql/admin-pass' value='{{mysql.root_password}}' vtype='password' + +# Webserver, die automatisch konfiguriert werden sollen: +# Choices: apache2, lighttpd +# phpmyadmin phpmyadmin/reconfigure-webserver multiselect +- name: debconf for pma reconfigure-webserver + sudo: yes + debconf: name=phpmyadmin question='phpmyadmin/reconfigure-webserver' value='apache2' vtype='multiselect' - name: install pma sudo: yes apt: pkg=phpmyadmin state=present + notify: + - restart apache -- name: configure phpmyadmin for apache - include: pma-apache.yml - when: apache.install=='apachephp' - -#- name: configure phpmyadmin for nginx -# include: pma-nginx.yml -# when: web_server=='nginxphp'# - -#- name: configure phpmyadmin for nginx -# include: pma-nginx.yml -# when: web_server=='nginxhhvm' - -- name: Add phpmyadmin.vb1 to the /etc/hosts file - lineinfile: dest=/etc/hosts line='127.0.0.1 {{ item.hostname }}' state=present - with_items: phpmyadmin - -- name: Configure phpmyadmin database user - lineinfile: dest=/etc/phpmyadmin/config-db.php - regexp="dbuser=" - line="$dbuser='{{ item.user }}';" - state=present - with_items: phpmyadmin - -- name: Configure phpmyadmin database password - lineinfile: dest=/etc/phpmyadmin/config-db.php - regexp="dbpass=" - line="$dbpass='{{ item.pass }}';" - state=present - with_items: phpmyadmin - -- name: Configure phpmyadmin database database name - lineinfile: dest=/etc/phpmyadmin/config-db.php - regexp="dbname=" - line="$dbname='{{ item.pma_dbname }}';" - state=present - with_items: phpmyadmin - -- name: Create the phpmyadmin database - sudo: yes - mysql_db: name={{ item.pma_dbname }} state=present - with_items: phpmyadmin - -- name: create the phpmyadmin user - mysql_user: name={{ item.user }} password={{ item.pass }} priv={{ item.pma_dbname }}.*:ALL state=present host='%' - with_items: phpmyadmin - -- name: setup the phpmyadmin db - shell: mysql -u{{ item.user }} -p{{ item.pass }} {{ item.pma_dbname }} < /usr/share/dbconfig-common/data/phpmyadmin/install/mysql - with_items: phpmyadmin +# - name: configure site +# file: path=/var/www/html/phpmyadmin src=/usr/share/phpmyadmin state=link diff --git a/ansible/roles/phpmyadmin/tasks/main.yml b/ansible/roles/phpmyadmin/tasks/main.yml index 6e61a18..591f778 100755 --- a/ansible/roles/phpmyadmin/tasks/main.yml +++ b/ansible/roles/phpmyadmin/tasks/main.yml @@ -1,3 +1,3 @@ --- - include: install.yml - when: mysql.install + when: phpmyadmin.install diff --git a/ansible/roles/phpmyadmin/tasks/pma-apache.yml b/ansible/roles/phpmyadmin/tasks/pma-apache.yml deleted file mode 100755 index 98ee9c3..0000000 --- a/ansible/roles/phpmyadmin/tasks/pma-apache.yml +++ /dev/null @@ -1,11 +0,0 @@ -- name: configure phpmyadmin for apache - file: path=/var/www/phpmyadmin src=/usr/share/phpmyadmin state=link - -- name: configure phpmyadmin for apache - template: src=phpmyadmin.conf.tpl dest=/etc/apache2/conf-available/phpmyadmin.conf - with_items: phpmyadmin - -- name: configure phpmyadmin for apache - notify: restart apache - sudo: yes - command: a2enconf phpmyadmin \ No newline at end of file diff --git a/ansible/roles/phpmyadmin/tasks/pma-nginx.yml b/ansible/roles/phpmyadmin/tasks/pma-nginx.yml deleted file mode 100755 index 0651f00..0000000 --- a/ansible/roles/phpmyadmin/tasks/pma-nginx.yml +++ /dev/null @@ -1,16 +0,0 @@ -- name: Create the folder for the phpmyadmin installation - sudo: yes - file: path=/usr/share/nginx/www state=directory - -- name: configure phpmyadmin for nginx - sudo: yes - file: path=/usr/share/nginx/www/phpmyadmin src=/usr/share/phpmyadmin state=link - -- name: configuration of phpmyadmin in sites-available for nginx - template: src=nginx-phpmyadmin.tpl dest=/etc/nginx/sites-available/phpmyadmin - with_items: phpmyadmin - -- name: enabling phpmyadmin for nginx - sudo: yes - file: path=/etc/nginx/sites-enabled/phpmyadmin src=/etc/nginx/sites-available/phpmyadmin state=link - notify: restart nginx \ No newline at end of file diff --git a/ansible/roles/phpmyadmin/templates/nginx-phpmyadmin.tpl b/ansible/roles/phpmyadmin/templates/nginx-phpmyadmin.tpl deleted file mode 100755 index 19f8838..0000000 --- a/ansible/roles/phpmyadmin/templates/nginx-phpmyadmin.tpl +++ /dev/null @@ -1,38 +0,0 @@ -server { - listen 80; - server_name {{ item.hostname }}; - access_log /var/log/phpmyadminaccess.log; - error_log /var/log/phpmyadminierror.log; - root /usr/share/nginx/www/phpmyadmin; - - location / { - index index.php; - } - - ## Images and static content is treated different - location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { - access_log off; - expires 360d; - } - - location ~ /\.ht { - deny all; - } - - location ~ /(libraries|setup/frames|setup/libs) { - deny all; - return 404; - } - - location ~ \.php$ { - include /etc/nginx/fastcgi_params; - fastcgi_pass unix:/var/run/php5-fpm.sock; - - #check your /etc/php5/fpm/pool.d/www.conf to see if fpm is listening on a socket or a port. - #;listen = /var/run/php5-fpm.sock - #listen = 127.0.0.1:9000 - - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME /usr/share/nginx/www/phpmyadmin$fastcgi_script_name; - } -} \ No newline at end of file diff --git a/ansible/roles/phpmyadmin/templates/phpmyadmin.conf.tpl b/ansible/roles/phpmyadmin/templates/phpmyadmin.conf.tpl deleted file mode 100755 index 7a9e5d7..0000000 --- a/ansible/roles/phpmyadmin/templates/phpmyadmin.conf.tpl +++ /dev/null @@ -1,47 +0,0 @@ -# phpMyAdmin default Apache configuration - -Alias /phpmyadmin /usr/share/phpmyadmin - - - Options FollowSymLinks - DirectoryIndex index.php - - - AddType application/x-httpd-php .php - - php_flag magic_quotes_gpc Off - php_flag track_vars On - php_flag register_globals Off - php_admin_flag allow_url_fopen Off - php_value include_path . - php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp - php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/ - - - - -# Authorize for setup - - - AuthType Basic - AuthName "phpMyAdmin Setup" - AuthUserFile /etc/phpmyadmin/htpasswd.setup - - Require valid-user - - -# Disallow web access to directories that don't need it - - Order Deny,Allow - Deny from All - - - Order Deny,Allow - Deny from All - - - - DocumentRoot /usr/share/phpmyadmin - ServerName {{ item.hostname }} - ServerAlias www.{{ item.hostname }} - \ No newline at end of file From 4ed5b08345cfead5e632b671bff9dba47235695c Mon Sep 17 00:00:00 2001 From: Joel Gerhold Date: Tue, 20 Oct 2015 12:07:58 +0200 Subject: [PATCH 3/9] Add nodejs --- ansible/roles/common/meta/main.yml | 1 + ansible/roles/nodejs/tasks/grunt-install.yml | 4 ++ ansible/roles/nodejs/tasks/gulp-install.yml | 4 ++ ansible/roles/nodejs/tasks/install.yml | 43 ++++++++++++++++++++ ansible/roles/nodejs/tasks/main.yml | 3 ++ ansible/roles/nodejs/tasks/taskrunner.yml | 6 +++ 6 files changed, 61 insertions(+) create mode 100644 ansible/roles/nodejs/tasks/grunt-install.yml create mode 100644 ansible/roles/nodejs/tasks/gulp-install.yml create mode 100644 ansible/roles/nodejs/tasks/install.yml create mode 100644 ansible/roles/nodejs/tasks/main.yml create mode 100644 ansible/roles/nodejs/tasks/taskrunner.yml diff --git a/ansible/roles/common/meta/main.yml b/ansible/roles/common/meta/main.yml index c537e8f..4f910ef 100644 --- a/ansible/roles/common/meta/main.yml +++ b/ansible/roles/common/meta/main.yml @@ -8,3 +8,4 @@ dependencies: - composer - phpmyadmin - varnish + - nodejs diff --git a/ansible/roles/nodejs/tasks/grunt-install.yml b/ansible/roles/nodejs/tasks/grunt-install.yml new file mode 100644 index 0000000..b529016 --- /dev/null +++ b/ansible/roles/nodejs/tasks/grunt-install.yml @@ -0,0 +1,4 @@ +--- +- name: Grunt | Grunt CLI install + shell: npm install -g grunt-cli + sudo: yes diff --git a/ansible/roles/nodejs/tasks/gulp-install.yml b/ansible/roles/nodejs/tasks/gulp-install.yml new file mode 100644 index 0000000..d82ecfa --- /dev/null +++ b/ansible/roles/nodejs/tasks/gulp-install.yml @@ -0,0 +1,4 @@ +--- +- name: Gulp | Gulp CLI install + shell: npm install -g gulp-cli + sudo: yes \ No newline at end of file diff --git a/ansible/roles/nodejs/tasks/install.yml b/ansible/roles/nodejs/tasks/install.yml new file mode 100644 index 0000000..283fb2f --- /dev/null +++ b/ansible/roles/nodejs/tasks/install.yml @@ -0,0 +1,43 @@ +--- +- name: Ensure Ubuntu Distro is Supported + get_url: + url='https://deb.nodesource.com/node/dists/{% verbatim %}{{ ansible_distribution_release }}{% endverbatim %}/Release' + dest=/dev/null + register: distrosupported + +- name: Remove Old Chris Lea PPA + apt_repository: + repo='ppa:chris-lea/node.js' + state=absent + when: distrosupported|success + +- name: Remove Old Chris Lea Sources + file: + path='/etc/apt/sources.list.d/chris-lea-node_js-{% verbatim %}{{ ansible_distribution_release }}{% endverbatim %}.list' + state=absent + when: distrosupported|success + +- name: Add Nodesource Keys + apt_key: + url=https://deb.nodesource.com/gpgkey/nodesource.gpg.key + state=present + +- name: Add Nodesource Apt Sources List Deb + apt_repository: + repo='deb https://deb.nodesource.com/node {% verbatim %}{{ ansible_distribution_release }}{% endverbatim %} main' + state=present + when: distrosupported|success + +- name: Add Nodesource Apt Sources List Deb Src + apt_repository: + repo='deb-src https://deb.nodesource.com/node {% verbatim %}{{ ansible_distribution_release }}{% endverbatim %} main' + state=present + when: distrosupported|success + +- name: Install NodeJS + apt: pkg=nodejs state=latest update_cache=true + when: distrosupported|success + register: nodejsinstalled + +- include: taskrunner.yml + when nodejsinstalled|success diff --git a/ansible/roles/nodejs/tasks/main.yml b/ansible/roles/nodejs/tasks/main.yml new file mode 100644 index 0000000..773cf39 --- /dev/null +++ b/ansible/roles/nodejs/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include: install.yml + when: nodejs.install diff --git a/ansible/roles/nodejs/tasks/taskrunner.yml b/ansible/roles/nodejs/tasks/taskrunner.yml new file mode 100644 index 0000000..4690b18 --- /dev/null +++ b/ansible/roles/nodejs/tasks/taskrunner.yml @@ -0,0 +1,6 @@ +--- +- include: grunt-install.yml + when: nodejs.grunt + +- include: gulp-install.yml + when: nodejs.gulp From f4b491948864419ce65b8e38218e3ad2a29f38a6 Mon Sep 17 00:00:00 2001 From: JG Date: Wed, 21 Oct 2015 15:14:02 +0200 Subject: [PATCH 4/9] Find nodejs install script --- ansible/roles/common/meta/main.yml | 1 + ansible/roles/nodejs/tasks/install.yml | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ansible/roles/common/meta/main.yml b/ansible/roles/common/meta/main.yml index 4f910ef..1d0b2ab 100644 --- a/ansible/roles/common/meta/main.yml +++ b/ansible/roles/common/meta/main.yml @@ -9,3 +9,4 @@ dependencies: - phpmyadmin - varnish - nodejs + diff --git a/ansible/roles/nodejs/tasks/install.yml b/ansible/roles/nodejs/tasks/install.yml index 283fb2f..3f7214c 100644 --- a/ansible/roles/nodejs/tasks/install.yml +++ b/ansible/roles/nodejs/tasks/install.yml @@ -1,7 +1,7 @@ --- - name: Ensure Ubuntu Distro is Supported get_url: - url='https://deb.nodesource.com/node/dists/{% verbatim %}{{ ansible_distribution_release }}{% endverbatim %}/Release' + url='https://deb.nodesource.com/node/dists/{{ ansible_distribution_release }}/Release' dest=/dev/null register: distrosupported @@ -12,32 +12,37 @@ when: distrosupported|success - name: Remove Old Chris Lea Sources + sudo: yes file: - path='/etc/apt/sources.list.d/chris-lea-node_js-{% verbatim %}{{ ansible_distribution_release }}{% endverbatim %}.list' + path='/etc/apt/sources.list.d/chris-lea-node_js-{{ ansible_distribution_release }}.list' state=absent when: distrosupported|success - name: Add Nodesource Keys + sudo: yes apt_key: url=https://deb.nodesource.com/gpgkey/nodesource.gpg.key state=present - name: Add Nodesource Apt Sources List Deb + sudo: yes apt_repository: - repo='deb https://deb.nodesource.com/node {% verbatim %}{{ ansible_distribution_release }}{% endverbatim %} main' + repo='deb https://deb.nodesource.com/node {{ ansible_distribution_release }} main' state=present when: distrosupported|success - name: Add Nodesource Apt Sources List Deb Src + sudo: yes apt_repository: - repo='deb-src https://deb.nodesource.com/node {% verbatim %}{{ ansible_distribution_release }}{% endverbatim %} main' + repo='deb-src https://deb.nodesource.com/node {{ ansible_distribution_release }} main' state=present when: distrosupported|success - name: Install NodeJS + sudo: yes apt: pkg=nodejs state=latest update_cache=true when: distrosupported|success register: nodejsinstalled - include: taskrunner.yml - when nodejsinstalled|success + when: nodejsinstalled|success From 49bea7d7e815047b91a5367a35dea75484082e0b Mon Sep 17 00:00:00 2001 From: JG Date: Wed, 21 Oct 2015 15:28:12 +0200 Subject: [PATCH 5/9] Add phpmyadmin and nodes defaults --- ansible/vars/default.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ansible/vars/default.yml b/ansible/vars/default.yml index b4b8fd3..032caf1 100644 --- a/ansible/vars/default.yml +++ b/ansible/vars/default.yml @@ -62,3 +62,12 @@ varnish: default_config: source: ~ target: /etc/varnish/default.vcl +phpmyadmin: + install: false + dbname: phpmyadmin + dbuser: phpmyadmin + dbpass: phpmyadmin +nodejs: + install: false + grunt: false + gulp: false From b06a395de56893fce189971858b1402132fc4083 Mon Sep 17 00:00:00 2001 From: JG Date: Thu, 22 Oct 2015 13:41:46 +0200 Subject: [PATCH 6/9] Add check for apt-transport-https in node role --- ansible/roles/nodejs/tasks/install.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ansible/roles/nodejs/tasks/install.yml b/ansible/roles/nodejs/tasks/install.yml index 3f7214c..1a5aceb 100644 --- a/ansible/roles/nodejs/tasks/install.yml +++ b/ansible/roles/nodejs/tasks/install.yml @@ -38,10 +38,16 @@ state=present when: distrosupported|success -- name: Install NodeJS +- name: Test for apt-transport-https sudo: yes apt: pkg=nodejs state=latest update_cache=true when: distrosupported|success + register: apttransporthttps + +- name: Install NodeJS + sudo: yes + apt: pkg=nodejs state=latest update_cache=true + when: apttransporthttps|success register: nodejsinstalled - include: taskrunner.yml From 515ee10be9e3f0517d67f1d1a7d243ef2cb1160e Mon Sep 17 00:00:00 2001 From: JG Date: Thu, 22 Oct 2015 16:45:55 +0200 Subject: [PATCH 7/9] Fix apt-transport-install --- ansible/roles/nodejs/tasks/install.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ansible/roles/nodejs/tasks/install.yml b/ansible/roles/nodejs/tasks/install.yml index 1a5aceb..fd03e0a 100644 --- a/ansible/roles/nodejs/tasks/install.yml +++ b/ansible/roles/nodejs/tasks/install.yml @@ -18,36 +18,36 @@ state=absent when: distrosupported|success +- name: Install for apt-transport-https + sudo: yes + apt: pkg=apt-transport-https state=latest update_cache=true + register: apttransporthttps + when: distrosupported|success + - name: Add Nodesource Keys sudo: yes apt_key: url=https://deb.nodesource.com/gpgkey/nodesource.gpg.key state=present + when: apttransporthttps|success - name: Add Nodesource Apt Sources List Deb sudo: yes apt_repository: repo='deb https://deb.nodesource.com/node {{ ansible_distribution_release }} main' state=present - when: distrosupported|success + when: apttransporthttps|success - name: Add Nodesource Apt Sources List Deb Src sudo: yes apt_repository: repo='deb-src https://deb.nodesource.com/node {{ ansible_distribution_release }} main' state=present - when: distrosupported|success - -- name: Test for apt-transport-https - sudo: yes - apt: pkg=nodejs state=latest update_cache=true - when: distrosupported|success - register: apttransporthttps + when: apttransporthttps|success - name: Install NodeJS sudo: yes apt: pkg=nodejs state=latest update_cache=true - when: apttransporthttps|success register: nodejsinstalled - include: taskrunner.yml From ed555bdd90d8a75886f362073f2ee2641ff3761e Mon Sep 17 00:00:00 2001 From: JG Date: Thu, 22 Oct 2015 16:48:51 +0200 Subject: [PATCH 8/9] Use xdebug.remote_connect_back --- ansible/roles/xdebug/templates/xdebug.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ansible/roles/xdebug/templates/xdebug.ini b/ansible/roles/xdebug/templates/xdebug.ini index 27f6cbb..9334ac1 100644 --- a/ansible/roles/xdebug/templates/xdebug.ini +++ b/ansible/roles/xdebug/templates/xdebug.ini @@ -1,3 +1,4 @@ zend_extension=xdebug.so xdebug.remote_enable=On -xdebug.remote_host={{ php.xdebug.host|default(xdebug_ip_address.stdout, true) }} +#xdebug.remote_host={{ php.xdebug.host|default(xdebug_ip_address.stdout, true) }} +xdebug.remote_connect_back=1 From 2fdf682afcf02eba406c24559a58d3e39394ce81 Mon Sep 17 00:00:00 2001 From: JG Date: Thu, 22 Oct 2015 17:08:04 +0200 Subject: [PATCH 9/9] include remote_host --- ansible/roles/xdebug/templates/xdebug.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/xdebug/templates/xdebug.ini b/ansible/roles/xdebug/templates/xdebug.ini index 9334ac1..3f903d4 100644 --- a/ansible/roles/xdebug/templates/xdebug.ini +++ b/ansible/roles/xdebug/templates/xdebug.ini @@ -1,4 +1,4 @@ zend_extension=xdebug.so xdebug.remote_enable=On -#xdebug.remote_host={{ php.xdebug.host|default(xdebug_ip_address.stdout, true) }} +xdebug.remote_host={{ php.xdebug.host|default(xdebug_ip_address.stdout, true) }} xdebug.remote_connect_back=1