From c8a25a78c32e6311c60197cbc6a4a43dcd50d2cf Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Mon, 10 Jun 2019 20:20:42 +0200 Subject: [PATCH] ansible-playbooks/general#85 Linting [skip-ci] --- tasks/cleanup.yml | 16 ++++++++-------- tasks/ec2/inithost.yml | 21 ++++++++++++--------- tasks/ec2/inithostip.yml | 16 ++++++++-------- tasks/main.yml | 4 ++-- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/tasks/cleanup.yml b/tasks/cleanup.yml index f08b0ed..3ee0c7d 100644 --- a/tasks/cleanup.yml +++ b/tasks/cleanup.yml @@ -3,26 +3,26 @@ - name: Remove host from known_hosts known_hosts: - name="{{ item }}" - state="absent" + name: '{{ item }}' + state: absent with_items: - {{ static_ipv4|default(false) }} - {{ host }} - name: Remove host from hosts file 1 lineinfile: - dest=/etc/hosts - regexp='{{ item }}' - state=absent + dest: /etc/hosts + regexp: '{{ item }}' + state: absent become: yes with_items: - ^{{ static_ipv4|default(false) }} - name: Remove host from hosts file 2 lineinfile: - dest=/etc/hosts - regexp='{{ item }}' - state=absent + dest: /etc/hosts + regexp: '{{ item }}' + state: absent become: yes with_items: - .* {{ host }}$ diff --git a/tasks/ec2/inithost.yml b/tasks/ec2/inithost.yml index 48caca9..8499ec6 100644 --- a/tasks/ec2/inithost.yml +++ b/tasks/ec2/inithost.yml @@ -6,7 +6,10 @@ - name: Create the new instance ec2: - instance_tags: {"Name":"Ansible-Host-{{ host }}","AnsibleHost":"{{ host }}","AnsibleGroups":"{{ initgroups }}"} + instance_tags: + Name: Ansible-Host-{{ host }} + AnsibleHost: '{{ host }}' + AnsibleGroups: '{{ initgroups }}' assign_public_ip: yes group_id: "{{ ec2_group_id }}" key_name: "{{ ec2_key_name }}" @@ -28,15 +31,15 @@ - block: - - name: Associate an elastic IP with the new instance - ec2_eip: - device_id: "{{ item }}" - public_ip: '{{ inithostip }}' - region: "{{ ec2_region }}" - state: present - with_items: '{{ ec2.instance_ids }}' + - name: Associate an elastic IP with the new instance + ec2_eip: + device_id: "{{ item }}" + public_ip: '{{ inithostip }}' + region: "{{ ec2_region }}" + state: present + with_items: '{{ ec2.instance_ids }}' - - import_tasks: inithostip.yml hostip='{{ inithostip }}' + - import_tasks: inithostip.yml hostip='{{ inithostip }}' when: inithostip is defined diff --git a/tasks/ec2/inithostip.yml b/tasks/ec2/inithostip.yml index f2b75b4..de71cb6 100644 --- a/tasks/ec2/inithostip.yml +++ b/tasks/ec2/inithostip.yml @@ -3,14 +3,14 @@ - name: Add new instance(s) to the inventory add_host: - hostname="{{ host }}" - static_ipv4="{{ hostip }}" - groups="{{ initgroups }}" + hostname: '{{ host }}' + static_ipv4: '{{ hostip }}' + groups: '{{ initgroups }}' - name: Waiting for SSH service becoming available wait_for: - host="{{ hostip }}" - port=22 - delay=10 - timeout=120 - state=present + host: '{{ hostip }}' + port: 22 + delay: 10 + timeout: 120 + state: present diff --git a/tasks/main.yml b/tasks/main.yml index 1b36010..8f4d191 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -9,8 +9,8 @@ - block: - - import_tasks: "{{ cloud|default('none') }}/{{ mode }}.yml" + - import_tasks: "{{ cloud|default('none') }}/{{ mode }}.yml" - - import_tasks: "{{ mode }}.yml" + - import_tasks: "{{ mode }}.yml" when: not excluded_roles or "cloud" not in excluded_roles -- GitLab