[Cleanup] amazon-ec2, apache, bind, evolinux-todo, evomaintenance

Don't compare with empty string

Name all tasks

Variables should have space before and after their name
This commit is contained in:
Mathieu Trossevin 2020-06-18 17:52:10 +02:00
parent 0825d88552
commit 26eec48954
Signed by: mtrossevin
GPG Key ID: 81987323AE7F3E99
6 changed files with 23 additions and 21 deletions

View File

@ -3,34 +3,34 @@
- name: Launch new instance(s)
ec2:
state: present
aws_access_key: "{{aws_access_key}}"
aws_secret_key: "{{aws_secret_key}}"
region: "{{aws_region}}"
image: "{{ec2_base_ami}}"
instance_type: "{{ec2_instance_type}}"
count: "{{ec2_instance_count}}"
assign_public_ip: "{{ec2_public_ip}}"
group: "{{ec2_security_group.name}}"
key_name: "{{ec2_keyname}}"
aws_access_key: "{{ aws_access_key }}"
aws_secret_key: "{{ aws_secret_key }}"
region: "{{ aws_region }}"
image: "{{ ec2_base_ami }}"
instance_type: "{{ ec2_instance_type }}"
count: "{{ ec2_instance_count }}"
assign_public_ip: "{{ ec2_public_ip }}"
group: "{{ ec2_security_group.name }}"
key_name: "{{ ec2_keyname }}"
wait: yes
register: ec2
- name: Add newly created instance(s) to inventory
add_host:
hostname: "{{item.public_dns_name}}"
hostname: "{{ item.public_dns_name }}"
groupname: launched-instances
ansible_user: admin
ansible_ssh_common_args: "-o StrictHostKeyChecking=no"
with_items: "{{ec2.instances}}"
with_items: "{{ ec2.instances }}"
- debug:
msg: "Your newly created instance is reachable at: {{item.public_dns_name}}"
with_items: "{{ec2.instances}}"
msg: "Your newly created instance is reachable at: {{ item.public_dns_name }}"
with_items: "{{ ec2.instances }}"
- name: Wait for SSH to come up on all instances (give up after 2m)
wait_for:
state: started
host: "{{item.public_dns_name}}"
host: "{{ item.public_dns_name }}"
port: 22
timeout: 120
with_items: "{{ec2.instances}}"
with_items: "{{ ec2.instances }}"

View File

@ -10,7 +10,7 @@
force: no
tags:
- apache
- name: Load IP whitelist task
include: ip_whitelist.yml

View File

@ -14,7 +14,7 @@
# The last character "\u000A" is a line feed (LF), it's better to keep it
content: "{{ apache_serverstatus_suffix }}\u000A"
force: yes
when: apache_serverstatus_suffix != ""
when: apache_serverstatus_suffix
- name: generate random string for server-status suffix
shell: "apg -a 1 -M N -n 1 > {{ apache_serverstatus_suffix_file }}"

View File

@ -94,7 +94,7 @@
- debug:
var: chrootbind_run.stdout_lines
when: bind_chroot_set and chrootbind_run.stdout != ""
when: bind_chroot_set and chrootbind_run.stdout
- name: Modify OPTIONS in /etc/default/bind9 for chroot
replace:

View File

@ -10,4 +10,4 @@
- name: "Content of /etc/evolinux/todo.txt"
debug:
var: evolinux_todo.stdout_lines
when: evolinux_todo.stdout != ""
when: evolinux_todo.stdout

View File

@ -1,9 +1,11 @@
---
- set_fact:
- name: "Choose if minifirewall will need to be restarted"
set_fact:
minifirewall_restart_handler_name: "{{ minifirewall_restart_if_needed | ternary('restart minifirewall', 'restart minifirewall (noop)') }}"
- assert:
- name: "Check that API variables are set"
assert:
that:
- evomaintenance_api_endpoint is not none
- evomaintenance_api_key is not none