summaryrefslogtreecommitdiffstats
path: root/playbooks/el7_temp_instance.yml
blob: d47742d9dbbfe91b54e68e8e6c91f2093c4e5528 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# setup a transient fedora instance
# optionally can take --extra-vars="hostbase=hostnamebase root_auth_users='user1 user2 user3'"

- name: check/create instance
  hosts: lockbox01.phx2.fedoraproject.org
  user: root
  gather_facts: False

  vars_files: 
   - /srv/web/infra/ansible/vars/global.yml
   - "{{ private }}/vars.yml"
  vars:
  - keypair: fedora-admin-20130801
  - image: "{{ el7_qcow_id }}"
  - instance_type: m1.small
  - security_group: default

  tasks:
  - include: "{{ tasks }}/transient_cloud.yml"

- name: provision instance
  hosts: tmp_just_created
  gather_facts: True

  vars_files: 
   - /srv/web/infra/ansible/vars/global.yml
   - "{{ private }}/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  tasks:
  - name: install cloud-utils
    yum: pkg=cloud-utils state=installed

  - name: growpart /dev/vda1 partition (/) to full size
    action: command growpart /dev/vda 1
    register: growpart
    always_run: true
    changed_when: "growpart.rc != 1"
    failed_when: growpart.rc == 2

  - name: resize the /dev/vda 1 fs
    action: command resize2fs /dev/vda1
    when: growpart.rc == 0

  - name: put the mbr back - b/c the resize breaks booting otherwise
    action: shell cat /usr/share/syslinux/mbr.bin > /dev/vda
    when: growpart.rc == 0


  - include: "{{ tasks }}/cloud_setup_basic.yml"

  handlers:
  - include: "{{ handlers }}/restart_services.yml"