Created
November 15, 2016 04:03
-
-
Save joonan30/f9def6e2c8fce5574a65c86ba93a277e to your computer and use it in GitHub Desktop.
Ansible installation EC2 instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - hosts: <hostname> | |
| remote_user: ec2-user | |
| vars: | |
| s3_spiegel_path: user_s3bucket/path/ | |
| remote_spiegel_dir: data | |
| tasks: | |
| - name: Installing R | |
| yum: name=R state=latest | |
| become: yes | |
| - name: Installing tree | |
| yum: name=tree state=latest | |
| become: yes | |
| - name: Create .aws dir | |
| file: path=/home/ec2-user/.aws/ state=directory mode=0755 | |
| - name: Touch .aws/credentials | |
| file: path=/home/ec2-user/.aws/credentials state=touch mode="u=rw,g=r,o=r" | |
| - name: Touch .aws/config | |
| file: path=/home/ec2-user/.aws/config state=touch mode="u=rw,g=r,o=r" | |
| - name: Adding key to credentials | |
| ini_file: dest=/home/ec2-user/.aws/credentials section=default option=aws_access_key_id value=KEY mode=0644 | |
| - name: Adding key to credentials | |
| ini_file: dest=/home/ec2-user/.aws/credentials section=default option=aws_secret_access_key value=VALUE | |
| - name: Adding region to config | |
| ini_file: dest=/home/ec2-user/.aws/config section=default option=region value=us-east-1 | |
| - name: Install R package - plyr | |
| shell: Rscript -e 'install.packages("plyr", repos="https://cran.rstudio.com")' | |
| become: yes | |
| - name: Create spiegel directory | |
| file: path=/home/ec2-user/{{ remote_spiegel_dir }}/ state=directory mode=0755 | |
| - name: Copying down the latest Spiegel from S3 | |
| shell: aws s3 cp s3://{{ s3_spiegel_path }}/ {{ remote_spiegel_dir }} --recursive | |
| args: | |
| chdir: /home/ec2-user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment