From 3e9071903ac30cc306ccd34372087c6492106e57 Mon Sep 17 00:00:00 2001 From: Justin Wind Date: Thu, 9 Mar 2017 16:38:37 -0800 Subject: [PATCH] finish fixing common --- ansible.cfg | 2 +- management.yml | 7 +------ roles/aws-infrastructure/tasks/main.yml | 2 +- roles/common/tasks/main.yml | 23 ++++++++++++++++++----- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/ansible.cfg b/ansible.cfg index c6ee886..de5f2b3 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -3,4 +3,4 @@ retry_files_enabled = False host_key_checking = False inventory = inventory remote_user = ec2-user -private_key_file = keys/awskey.pem +private_key_file = keys/management.pem diff --git a/management.yml b/management.yml index b308c43..912a673 100644 --- a/management.yml +++ b/management.yml @@ -1,11 +1,6 @@ --- -- hosts: localhost - connection: local - roles: - - aws-infrastructure - - hosts: management become: true roles: - common - - management +# - management diff --git a/roles/aws-infrastructure/tasks/main.yml b/roles/aws-infrastructure/tasks/main.yml index 83085db..8aa65bf 100644 --- a/roles/aws-infrastructure/tasks/main.yml +++ b/roles/aws-infrastructure/tasks/main.yml @@ -199,7 +199,7 @@ launch_config_name: "{{ mgmt_lc.name }}" notification_topic: "{{ management_topic.sns_arn }}" notification_types: - - autoscaling:EC2_INSTANCE_LAUNCH + - autoscaling:EC2_INSTANCE_LAUNCH load_balancers: - management-int-elb tags: diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 1cbf044..12c6ff1 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -1,5 +1,10 @@ --- +- 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 @@ -10,19 +15,26 @@ 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 @@ -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 -- 2.45.2