xqueue.yml 1.38 KB
Newer Older
John Jarvis committed
1 2
- name: Deploy xqueue
  hosts: all
3
  become: True
4
  gather_facts: True
5
  vars:
6 7 8 9 10 11
    # By default take instances in and out of the elb(s) they
    # are attached to
    # To skip elb operations use "-e elb_pre_post=fase"
    elb_pre_post: true
    # Number of instances to operate on at a time
    serial_count: 1
12
    CLUSTER_NAME: 'commoncluster'
13 14 15 16
  serial: "{{ serial_count }}"
  pre_tasks:
    - action: ec2_facts
      when: elb_pre_post
17 18
    - debug:
        var:  "{{ ansible_ec2_instance_id }}"
19 20
      when: elb_pre_post
    - name: Instance De-register
21
      local_action: ec2_elb
22 23 24 25
      args:
        instance_id: "{{ ansible_ec2_instance_id }}"
        region: us-east-1
        state: absent
26
        wait_timeout: 60
27
      become: False
28
      when: elb_pre_post
John Jarvis committed
29
  roles:
30
    - aws
31 32 33
    - role: nginx
      nginx_sites:
      - xqueue
34
    - xqueue
35
    - role: datadog
36
      when: COMMON_ENABLE_DATADOG
John Jarvis committed
37
    - role: splunkforwarder
38
      when: COMMON_ENABLE_SPLUNKFORWARDER
39
    - role: newrelic
40
      when: COMMON_ENABLE_NEWRELIC
41
  post_tasks:
42 43
    - debug:
        var:  "{{ ansible_ec2_instance_id }}"
44 45
      when: elb_pre_post
    - name: Register instance in the elb
46
      local_action: ec2_elb
47 48
      args:
        instance_id: "{{ ansible_ec2_instance_id }}"
49
        ec2_elbs: "{{ ec2_elbs }}"
50 51
        region: us-east-1
        state: present
52
        wait_timeout: 60
53
      become: False
54
      when: elb_pre_post