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

ansible-playbooks/general#85 Linting

parent ae4afc57
Branches
No related tags found
No related merge requests found
--- ---
# file: cleanup.yml # file: cleanup.yml
- name: "Remove host from known_hosts" - name: Remove host from known_hosts
known_hosts: known_hosts:
name="{{ item }}" name="{{ item }}"
state="absent" state="absent"
with_items: with_items:
- '{{ static_ipv4|default(false) }}' - {{ static_ipv4|default(false) }}
- '{{ host }}' - {{ host }}
- name: "Remove host from hosts file 1" - name: Remove host from hosts file 1
lineinfile: lineinfile:
dest=/etc/hosts dest=/etc/hosts
regexp='{{ item }}' regexp='{{ item }}'
state=absent state=absent
become: yes become: yes
with_items: with_items:
- '^{{ static_ipv4|default(false) }} ' - ^{{ static_ipv4|default(false) }}
- name: "Remove host from hosts file 2" - name: Remove host from hosts file 2
lineinfile: lineinfile:
dest=/etc/hosts dest=/etc/hosts
regexp='{{ item }}' regexp='{{ item }}'
state=absent state=absent
become: yes become: yes
with_items: with_items:
- '.* {{ host }}$' - .* {{ host }}$
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
--- ---
# file: ec2/inithost.yml # file: ec2/inithost.yml
- name: "Create the new instance" - name: Create the new instance
ec2: 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 assign_public_ip: yes
group_id: "{{ ec2_group_id }}" group_id: "{{ ec2_group_id }}"
key_name: "{{ ec2_key_name }}" key_name: "{{ ec2_key_name }}"
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
wait: yes wait: yes
register: ec2 register: ec2
- name: "Waiting for the new instance(s) to get up and running" - name: Waiting for the new instance(s) to get up and running
ec2: ec2:
instance_ids: "{{ ec2.instance_ids }}" instance_ids: "{{ ec2.instance_ids }}"
instance_type: "{{ ec2_instance_type }}" instance_type: "{{ ec2_instance_type }}"
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
- block: - block:
- name: "Associate an elastic IP with the new instance" - name: Associate an elastic IP with the new instance
ec2_eip: ec2_eip:
device_id: "{{ item }}" device_id: "{{ item }}"
public_ip: '{{ inithostip }}' public_ip: '{{ inithostip }}'
......
--- ---
# file: ec2/inithostip.yml # file: ec2/inithostip.yml
- name: "Add new instance(s) to the inventory" - name: Add new instance(s) to the inventory
add_host: add_host:
hostname="{{ host }}" hostname="{{ host }}"
static_ipv4="{{ hostip }}" static_ipv4="{{ hostip }}"
groups="{{ initgroups }}" groups="{{ initgroups }}"
- name: "Waiting for SSH service becoming available" - name: Waiting for SSH service becoming available
wait_for: wait_for:
host="{{ hostip }}" host="{{ hostip }}"
port=22 port=22
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
--- ---
# file: ec2/removehost.yml # file: ec2/removehost.yml
- name: "Terminate the instance" - name: Terminate the instance
ec2: ec2:
instance_ids: "{{ ec2_id }}" instance_ids: "{{ ec2_id }}"
instance_type: "{{ ec2_instance_type }}" instance_type: "{{ ec2_instance_type }}"
......
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
--- ---
# file: jiffybox/inithost.yml # file: jiffybox/inithost.yml
- name: "No cloud action required" - name: No cloud action required
debug: msg="IGNORE inithost" debug: msg="IGNORE inithost"
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
--- ---
# file: jiffybox/inithostip.yml # file: jiffybox/inithostip.yml
- name: "No cloud action required" - name: No cloud action required
debug: msg="IGNORE inithostip" debug: msg="IGNORE inithostip"
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
--- ---
# file: jiffybox/removehost.yml # file: jiffybox/removehost.yml
- name: "No cloud action required" - name: No cloud action required
debug: msg="IGNORE removehost" debug: msg="IGNORE removehost"
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
--- ---
# file: linode/inithost.yml # file: linode/inithost.yml
- name: "No cloud action required" - name: No cloud action required
debug: msg="IGNORE inithost" debug: msg="IGNORE inithost"
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
--- ---
# file: linode/inithostip.yml # file: linode/inithostip.yml
- name: "No cloud action required" - name: No cloud action required
debug: msg="IGNORE inithostip" debug: msg="IGNORE inithostip"
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
--- ---
# file: linode/removehost.yml # file: linode/removehost.yml
- name: "No cloud action required" - name: No cloud action required
debug: msg="IGNORE removehost" debug: msg="IGNORE removehost"
--- ---
# file: roles/cloud/tasks/main.yml # file: roles/cloud/tasks/main.yml
- name: "Cloud Role" - name: Cloud Role
set_fact: role_cloud_started=true set_fact:
tags: 'always' role_cloud_started: yes
tags:
- always
- block: - block:
...@@ -11,4 +13,4 @@ ...@@ -11,4 +13,4 @@
- import_tasks: "{{ mode }}.yml" - import_tasks: "{{ mode }}.yml"
when: '"cloud" not in excluded_roles' when: not excluded_roles or "cloud" not in excluded_roles
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
--- ---
# file: none/inithost.yml # file: none/inithost.yml
- name: "No cloud action required" - name: No cloud action required
debug: msg="IGNORE inithost" debug: msg="IGNORE inithost"
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
--- ---
# file: none/inithostip.yml # file: none/inithostip.yml
- name: "No cloud action required" - name: No cloud action required
debug: msg="IGNORE inithostip" debug: msg="IGNORE inithostip"
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
--- ---
# file: none/removehost.yml # file: none/removehost.yml
- name: "No cloud action required" - name: No cloud action required
debug: msg="IGNORE removehost" debug: msg="IGNORE removehost"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment