From 26bce3b9dfbab64c7792706e602623df9a62f88a Mon Sep 17 00:00:00 2001 From: David Moreau-Simard Date: Sat, 5 Nov 2016 11:32:41 -0400 Subject: [PATCH] Lint the lampstack wordpress role - Don't use shell module unless shell functionality is required Change-Id: I656e79c6d9eacbae1fa54724c3c2b06f0c2ab435 --- .../lampstack/roles/wordpress/tasks/main.yml | 50 ++++++++----------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/ansible/lampstack/roles/wordpress/tasks/main.yml b/ansible/lampstack/roles/wordpress/tasks/main.yml index 565f92b..b41f327 100755 --- a/ansible/lampstack/roles/wordpress/tasks/main.yml +++ b/ansible/lampstack/roles/wordpress/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Install wordpress - shell: > + command: > wp core install --path=/var/www/html --url="http://{{ hostvars.cloud.balancer.openstack.public_v4 }}" --title='OpenStack Interop Challenge' @@ -10,7 +10,7 @@ when: hostvars.cloud.balancer.openstack.public_v4 != "" - name: Install wordpress - shell: > + command: > wp core install --path=/var/www/html --url="http://{{ hostvars.cloud.balancer.openstack.private_v4 }}" --title='OpenStack Interop Challenge' @@ -20,60 +20,54 @@ when: hostvars.cloud.balancer.openstack.public_v4 == "" - name: Activate wordpress theme - shell: > + command: > wp --path=/var/www/html theme activate "{{ app_env.wp_theme.split('/').pop().split('.')[0] }}" - name: Download wordpress importer plugin get_url: url: "{{ app_env.wp_importer | default('http://downloads.wordpress.org/plugin/wordpress-importer.0.6.3.zip') }}" - dest: /tmp/wordpress-importer.zip - force: yes + dest: "/tmp/wordpress-importer.zip" + force: "yes" - name: Install wordpress importer plugin - shell: > - sudo -u www-data wp --path=/var/www/html - plugin install /tmp/wordpress-importer.zip --activate + command: > + sudo -u www-data wp --path=/var/www/html plugin install /tmp/wordpress-importer.zip --activate args: - warn: no + warn: "no" when: ansible_distribution == 'Ubuntu' - name: Install wordpress importer plugin - shell: > - sudo -u apache /usr/local/bin/wp --path=/var/www/html - plugin install /tmp/wordpress-importer.zip + command: > + sudo -u apache /usr/local/bin/wp --path=/var/www/html plugin install /tmp/wordpress-importer.zip args: - warn: no + warn: "no" when: ansible_distribution == 'Fedora' - name: Enable wordpress importer plugin - shell: > - sudo -u apache /usr/local/bin/wp --path=/var/www/html - plugin activate wordpress-importer + command: > + sudo -u apache /usr/local/bin/wp --path=/var/www/html plugin activate wordpress-importer args: - warn: no + warn: "no" when: ansible_distribution == 'Fedora' - - name: Download wordpress sample posts get_url: url: "{{ app_env.wp_posts }}" - dest: /tmp/wpposts.zip - force: yes + dest: "/tmp/wpposts.zip" + force: "yes" -- name: Unpack the post - shell: unzip -o -q /tmp/wpposts.zip -d /tmp/posts +- name: Unpack the posts + command: unzip -o -q /tmp/wpposts.zip -d /tmp/posts args: - warn: no + warn: "no" - name: Import wordpress posts - shell: > - sudo -u www-data wp --path=/var/www/html - import /tmp/posts/*.xml --authors=create --quiet + command: > + sudo -u www-data wp --path=/var/www/html import /tmp/posts/*.xml --authors=create --quiet when: ansible_distribution == 'Ubuntu' - name: Import wordpress posts shell: > - sudo -u apache /usr/local/bin/wp --path=/var/www/html - import /tmp/posts/*.xml --authors=create --quiet + sudo -u apache /usr/local/bin/wp --path=/var/www/html import /tmp/posts/*.xml --authors=create --quiet when: ansible_distribution == 'Fedora'