From 5da6dd18cd2abba84d9a8ebe67851016667365b2 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Wed, 26 Sep 2018 21:32:28 -0500 Subject: [PATCH] Fix Ansible lint issues. --- README.md | 6 ++--- defaults/main.yml | 23 +++++++++------- molecule/default/playbook-source-install.yml | 2 +- .../default/playbook-standalone-nginx-aws.yml | 27 ++++++++++--------- molecule/default/playbook.yml | 2 +- tasks/install-from-source.yml | 2 +- vars/Ubuntu-16.04.yml | 1 + 7 files changed, 34 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 5491e28..95f8239 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Currently there is one built-in method for generating new certificates using thi **For a complete example**: see the fully functional test playbook in [tests/test-standalone-nginx-aws.yml](tests/test-standalone-nginx-aws.yml). - certbot_create_if_missing: no + certbot_create_if_missing: false certbot_create_method: standalone Set `certbot_create_if_missing` to `yes` or `True` to let this role generate certs. Set the method used for generating certs with the `certbot_create_method` variable—current allowed values include: `standalone`. @@ -64,10 +64,10 @@ These services will only be stopped the first time a new cert is generated. You can install Certbot from it's Git source repository if desired. This might be useful in several cases, but especially when older distributions don't have Certbot packages available (e.g. CentOS < 7, Ubuntu < 16.10 and Debian < 8). - certbot_install_from_source: no + certbot_install_from_source: false certbot_repo: https://github.com/certbot/certbot.git certbot_version: master - certbot_keep_updated: yes + certbot_keep_updated: true Certbot Git repository options. To install from source, set `certbot_install_from_source` to `yes`. This clones the configured `certbot_repo`, respecting the `certbot_version` setting. If `certbot_keep_updated` is set to `yes`, the repository is updated every time this role runs. diff --git a/defaults/main.yml b/defaults/main.yml index 2e79029..65f9e3c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -7,17 +7,20 @@ certbot_auto_renew_minute: 30 certbot_auto_renew_options: "--quiet --no-self-upgrade" # Parameters used when creating new Certbot certs. -certbot_create_if_missing: no +certbot_create_if_missing: false certbot_create_method: standalone certbot_admin_email: email@example.com certbot_certs: [] - # - email: janedoe@example.com - # domains: - # - example1.com - # - example2.com - # - domains: - # - example3.com -certbot_create_command: "{{ certbot_script }} certonly --standalone --noninteractive --agree-tos --email {{ cert_item.email | default(certbot_admin_email) }} -d {{ cert_item.domains | join(',') }}" +# - email: janedoe@example.com +# domains: +# - example1.com +# - example2.com +# - domains: +# - example3.com +certbot_create_command: >- + "{{ certbot_script }} certonly --standalone --noninteractive --agree-tos + --email {{ cert_item.email | default(certbot_admin_email) }} + -d {{ cert_item.domains | join(',') }}" certbot_create_standalone_stop_services: - nginx # - apache @@ -25,10 +28,10 @@ certbot_create_standalone_stop_services: # To install from source (on older OSes or if you need a specific or newer # version of Certbot), set this variable to `yes` and configure other options. -certbot_install_from_source: no +certbot_install_from_source: false certbot_repo: https://github.com/certbot/certbot.git certbot_version: master -certbot_keep_updated: yes +certbot_keep_updated: true # Where to put Certbot when installing from source. certbot_dir: /opt/certbot diff --git a/molecule/default/playbook-source-install.yml b/molecule/default/playbook-source-install.yml index 65a374d..268ae13 100644 --- a/molecule/default/playbook-source-install.yml +++ b/molecule/default/playbook-source-install.yml @@ -22,4 +22,4 @@ roles: - geerlingguy.git - - geerlingguy.certbot \ No newline at end of file + - geerlingguy.certbot diff --git a/molecule/default/playbook-standalone-nginx-aws.yml b/molecule/default/playbook-standalone-nginx-aws.yml index a546169..481c688 100644 --- a/molecule/default/playbook-standalone-nginx-aws.yml +++ b/molecule/default/playbook-standalone-nginx-aws.yml @@ -9,7 +9,7 @@ # Play 1: Provision EC2 instance and A record. - hosts: localhost connection: local - gather_facts: no + gather_facts: false tasks: - name: Configure EC2 Security Group. @@ -50,9 +50,10 @@ Name: "certbot-standalone-nginx-test" group: ['default', 'certbot_test_http'] instance_type: t2.micro - image: ami-02e98f78 # CentOS Linux 7 x86_64 HVM EBS + # CentOS Linux 7 x86_64 HVM EBS + image: ami-02e98f78 region: "us-east-1" - wait: yes + wait: true wait_timeout: 500 exact_count: 1 count_tag: @@ -68,25 +69,25 @@ type: A ttl: 300 value: "{{ created_instance.tagged_instances.0.public_ip }}" - wait: yes - overwrite: yes + wait: true + overwrite: true - name: Add EC2 instance to inventory groups. add_host: name: "certbot-test.servercheck.in" groups: "aws,aws_nginx" ansible_ssh_user: centos - host_key_checking: False + host_key_checking: false when: created_instance.tagged_instances.0.id is defined # Play 2: Configure EC2 instance with Certbot and Nginx. - hosts: aws_nginx - gather_facts: yes - become: yes + gather_facts: true + become: true vars: certbot_admin_email: https@servercheck.in - certbot_create_if_missing: yes + certbot_create_if_missing: true certbot_create_standalone_stop_services: [] certbot_certs: - domains: @@ -107,7 +108,7 @@ pre_tasks: - name: Update apt cache. - apt: update_cache=yes cache_valid_time=600 + apt: update_cache=true cache_valid_time=600 when: ansible_os_family == 'Debian' changed_when: false @@ -135,12 +136,12 @@ url: https://certbot-test.servercheck.in/ status_code: 200 delegate_to: localhost - become: no + become: false # Play 3: Tear down EC2 instance and A record. - hosts: localhost connection: local - gather_facts: no + gather_facts: false tasks: - name: Destroy EC2 instance. @@ -149,7 +150,7 @@ instance_ids: ["{{ created_instance.tagged_instances.0.id }}"] region: "us-east-1" state: absent - wait: yes + wait: true wait_timeout: 500 - name: Delete Security Group. diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index 38ff20a..6552819 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -21,4 +21,4 @@ when: ansible_os_family == 'Debian' roles: - - geerlingguy.certbot \ No newline at end of file + - geerlingguy.certbot diff --git a/tasks/install-from-source.yml b/tasks/install-from-source.yml index 7d97f9b..daee685 100644 --- a/tasks/install-from-source.yml +++ b/tasks/install-from-source.yml @@ -5,7 +5,7 @@ dest: "{{ certbot_dir }}" version: "{{ certbot_version }}" update: "{{ certbot_keep_updated }}" - force: yes + force: true - name: Set Certbot script variable. set_fact: diff --git a/vars/Ubuntu-16.04.yml b/vars/Ubuntu-16.04.yml index 90e9138..83cf124 100644 --- a/vars/Ubuntu-16.04.yml +++ b/vars/Ubuntu-16.04.yml @@ -1 +1,2 @@ +--- certbot_package: letsencrypt