Skip to content
Snippets Groups Projects
Commit c8a25a78 authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-playbooks/general#85 Linting [skip-ci]

parent fe244ad2
No related branches found
No related tags found
No related merge requests found
......@@ -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 }}$
......@@ -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
......
......@@ -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
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment