From ff0699ec5c320fa7aa33478a791ebadffd127731 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Mon, 10 Jun 2019 12:51:00 +0200 Subject: [PATCH] ansible-playbooks/general#85 Linting --- defaults/main.yml | 4 ++-- tasks/apache.yml | 24 ++++++++++++------------ tasks/install.yml | 22 +++++++++++----------- tasks/main.yml | 18 ++++++++++-------- templates/app.yml | 8 ++++---- 5 files changed, 39 insertions(+), 37 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index fb65011..6cfb3b7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,2 @@ -discourse_git_repo: 'https://github.com/discourse/discourse_docker.git' -discourse_domain: '' +discourse_git_repo: https://github.com/discourse/discourse_docker.git +discourse_domain: diff --git a/tasks/apache.yml b/tasks/apache.yml index 7dedb51..f729d51 100644 --- a/tasks/apache.yml +++ b/tasks/apache.yml @@ -1,30 +1,30 @@ --- # file: roles/discourse/tasks/apache.yml -- name: "Apache Configuration File" +- name: Apache Configuration File template: - src: 'vhost.conf' - dest: '/etc/apache2/sites-available/discourse{{ apache_conf_ext }}' - owner: 'root' - group: 'root' - mode: '664' + src: vhost.conf + dest: /etc/apache2/sites-available/discourse{{ apache_conf_ext }} + owner: root + group: root + mode: 664 notify: - "Apache | Restart Apache" -- name: "Apache enable our new site(s)" +- name: Apache enable our new site(s) command: a2ensite discourse creates=/etc/apache2/sites-enabled/discourse{{ apache_conf_ext }} notify: - "Apache | Restart Apache" - block: - - name: "Setup AuthType Basic" + - name: Setup AuthType Basic htpasswd: - path: '/var/discourse/containers/passwords' + path: /var/discourse/containers/passwords name: '{{ discourse_apache_auth.user }}' password: '{{ discourse_apache_auth.password }}' - owner: 'root' - group: 'root' - mode: '664' + owner: root + group: root + mode: 664 when: discourse_apache_auth is defined diff --git a/tasks/install.yml b/tasks/install.yml index d61c4cf..510b4cf 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -1,27 +1,27 @@ --- # file: roles/discourse/tasks/install.yml -- name: "Clone Repository" +- name: Clone Repository git: accept_hostkey: yes repo: '{{ discourse_git_repo }}' - dest: '/var/discourse' + dest: /var/discourse register: discourse_repository - block: - - name: "Configure" + - name: Configure template: - src: 'app.yml' - dest: '/var/discourse/containers/app.yml' - owner: 'root' - group: 'root' - mode: '664' + src: app.yml + dest: /var/discourse/containers/app.yml + owner: root + group: root + mode: 664 - - name: "Install and Build" - shell: '/var/discourse/launcher rebuild app' + - name: Install and Build + shell: /var/discourse/launcher rebuild app when: discourse_repository.changed -- name: "Configure Apache" +- name: Configure Apache import_tasks: apache.yml diff --git a/tasks/main.yml b/tasks/main.yml index 79ba2bd..d06ca1e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,24 +1,26 @@ --- # file: roles/discourse/tasks/main.yml -- name: "Docker Discourse" - set_fact: role_discourse_started=true - tags: 'always' +- name: Docker Discourse + set_fact: + role_discourse_started: yes + tags: + - always - block: - - name: "Install Certs" - include_tasks: '../../letsencrypt/tasks/cert.yml' + - name: Install Certs + include_tasks: ../../letsencrypt/tasks/cert.yml with_items: - domain: '{{ discourse_domain }}' loop_control: loop_var: domain when: discourse_protocol|default("https") == "https" and discourse_letsencrypt|default(true) - when: '"letsencrypt" not in excluded_roles and groups.proxyserver is not defined' + when: not excluded_roles or "letsencrypt" not in excluded_roles and groups.proxyserver is not defined - block: - - name: "Install Discourse" + - name: Install Discourse import_tasks: install.yml - when: '"discourse" not in excluded_roles' + when: not excluded_roles or "discourse" not in excluded_roles diff --git a/templates/app.yml b/templates/app.yml index 9a41b7a..e90bd4d 100644 --- a/templates/app.yml +++ b/templates/app.yml @@ -47,7 +47,7 @@ env: #UNICORN_WORKERS: 3 ## TODO: The domain name this Discourse instance will respond to - DISCOURSE_HOSTNAME: {{ discourse_domain }} + DISCOURSE_HOSTNAME: '{{ discourse_domain }}' ## Uncomment if you want the container to be started with the same ## hostname (-h option) as specified above (default "$hostname-$config") @@ -58,9 +58,9 @@ env: DISCOURSE_DEVELOPER_EMAILS: '{{ apache_server_admin }}' ## TODO: The SMTP mail server used to validate new accounts and send notifications - DISCOURSE_SMTP_ADDRESS: {{ discourse_smtp.host }} - DISCOURSE_SMTP_PORT: {{ discourse_smtp.port }} - DISCOURSE_SMTP_USER_NAME: {{ discourse_smtp.user }} + DISCOURSE_SMTP_ADDRESS: '{{ discourse_smtp.host }}' + DISCOURSE_SMTP_PORT: '{{ discourse_smtp.port }}' + DISCOURSE_SMTP_USER_NAME: '{{ discourse_smtp.user }}' DISCOURSE_SMTP_PASSWORD: "{{ discourse_smtp.pass }}" #DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true) -- GitLab