finish fixing common
[awsible] / roles / common / tasks / main.yml
index 02f3b0ad88681c70a0b3d853fa046b060d636a65..12c6ff1637fda0e0082a4a2d514c512c70923675 100644 (file)
@@ -1,28 +1,40 @@
 ---
+- name: bootstrap /data
+  stat:
+    path: /data
+  register: datadir
 - include: volumes.yml
+  when: not datadir.stat.exists
 
 - name: Create local asset directory
   when: ASSET_PATH is defined
   file:
     state: directory
-    path: {{ ASSET_PATH }}
+    path: "{{ ASSET_PATH }}"
     mode: "0755"
     owner: root
     group: root
 
-- name: PIP prerequisites
+- name: Uninstall outdated python packages
   with_items:
+  - aws-cli
+  - python27-botocore
+  - python27-boto
+  yum:
+    package: "{{ item }}"
+    state: absent
+
+- name: Install new python packages
+  with_items:
+  - awscli
   - boto
   - boto3
-  - httplib2
-  - requests
   pip:
     name: "{{ item }}"
-    state: latest
+    state: present
 
 - name: Common packages
   with_items:
-  - aws-cli
   - cowsay
   - figlet
   - ipsec-tools
     group: root
 
 - name: Install any facts.
-  with_items: "{{ fact_scripts|default(None) }}"
+  with_items: "{{ fact_scripts|default([]) }}"
   copy:
     dest: /etc/ansible/facts.d/{{ item }}.fact
-    src: {{ item }}.fact
+    src: "{{ item }}.fact"
     mode: "0755"
     owner: root
     group: root
@@ -67,6 +79,7 @@
     state: list
     region: "{{ ansible_ec2_placement_region }}"
     resource: "{{ ansible_ec2_instance_id }}"
+  register: my_tags
 
 - name: Name instance from ID and ASG module
   when: my_tags['tags']['aws:autoscaling:groupName'] is defined