updated and separated from main setup.yml
diff --git a/setup-ec2.yml b/setup-ec2.yml index a0b00df..714478d 100644 --- a/setup-ec2.yml +++ b/setup-ec2.yml
@@ -6,51 +6,54 @@ tasks: - name: Install system packages + become: yes yum: name: '{{ item }}' state: present with_items: - - elasticache-auto-discover + - elasticache-auto-discovery when: ansible_os_family | lower == 'redhat' - name: Create a template .boto config file - template: + template: src: resources/boto.j2 dest: ~/.boto + mode: 0644 when: aws_access_key is defined and aws_secret_key is defined and aws_region is defined - name: Create a template ec2.ini config file copy: src: resources/ec2.ini dest: '{{ ansible_config }}/ec2.ini' + mode: 0644 - name: Update EC2_INI_PATH - lineinfile: + lineinfile: backup: yes dest: ~/.bashrc state: present line: 'export EC2_INI_PATH={{ ansible_config }}/ec2.ini' when: aws_access_key is defined and aws_secret_key is defined and aws_region is defined -# - name: Copy ec2.py script -# copy: -# src: resources/ec2.py -# dest: '{{ ansible_config }}/ec2.py' - + - name: Copy ec2.py script + copy: + src: resources/ec2.py + dest: '{{ ansible_config }}/ec2.py' + - name: Update .bashrc with aws_access_key - lineinfile: + lineinfile: backup: yes dest: ~/.bashrc state: present line: 'export AWS_SECRET_ACCESS_KEY={{ aws_access_key }}' when: aws_access_key is defined and update_env is defined and update_env - + - name: Update .bashrc with aws_secret_key - lineinfile: + lineinfile: backup: yes dest: ~/.bashrc state: present line: 'export AWS_ACCESS_KEY_ID={{ aws_secret_key }}' when: aws_secret_key is defined and update_env is defined and update_env - \ No newline at end of file +