ansible/roles/ansiblehost/tasks/main.yml

54 lines
1.1 KiB
YAML

#!/usr/bin/ansible-playbook
# vim:ft=ansible:
---
- name: Install Ansible-required packages via apt
apt:
name: "{{ packages }}"
vars:
packages:
- python3-pip
- python3-boto
- python3-boto3
- python3-botocore
become: true
- name: Install Ansible-required packages via pip
pip:
name: "{{ packages }}"
state: latest
vars:
packages:
- ansible
become: true
- name: Create .aws directory for salt
file:
path: ~/.aws
state: directory
become: true
become_user: salt
- name: Copy AWS credentials
copy:
src: "{{ role_path }}/files/awscredentials"
dest: ~/.aws/credentials
mode: 0600
become: true
become_user: salt
- name: Copy Ansible private key
copy:
src: "{{ role_path }}/files/ansiblekey"
dest: ~/.ssh/ansible
mode: 0600
become: true
become_user: salt
- name: Create Projects directory for salt
file:
path: ~/Projects
state: directory
become: true
become_user: salt
- name: Clone Ansible repository
git:
repo: https://gitlab.com/rehashedsalt/ansible
dest: ~/Projects/ansible
become: true
become_user: salt