Repurpose old ansiblehost role
It's now an automatic pullinator
This commit is contained in:
parent
9cf24c1acc
commit
129cc13848
@ -1,54 +1,45 @@
|
|||||||
#!/usr/bin/ansible-playbook
|
#!/usr/bin/ansible-playbook
|
||||||
# vim:ft=ansible:
|
# vim:ft=ansible:
|
||||||
---
|
---
|
||||||
- name: Install Ansible-required packages via apt
|
- name: Set up system for Ansible
|
||||||
apt:
|
- name: Install Ansible-required packages via apt
|
||||||
name: "{{ packages }}"
|
apt:
|
||||||
vars:
|
name: "{{ packages }}"
|
||||||
packages:
|
vars:
|
||||||
- python3-pip
|
packages:
|
||||||
- python3-boto
|
- python3-pip
|
||||||
- python3-boto3
|
- python3-boto
|
||||||
- python3-botocore
|
- python3-boto3
|
||||||
|
- python3-botocore
|
||||||
|
- name: Install Ansible-required packages via pip
|
||||||
|
pip:
|
||||||
|
name: "{{ packages }}"
|
||||||
|
state: latest
|
||||||
|
vars:
|
||||||
|
packages:
|
||||||
|
- ansible
|
||||||
|
- name: Create .aws directory for root
|
||||||
|
file:
|
||||||
|
path: ~/.aws
|
||||||
|
state: directory
|
||||||
|
- name: Copy AWS credentials
|
||||||
|
copy:
|
||||||
|
src: awscredentials
|
||||||
|
dest: ~/.aws/credentials
|
||||||
|
mode: 0600
|
||||||
|
- name: Copy Ansible private key
|
||||||
|
copy:
|
||||||
|
src: ansiblekey
|
||||||
|
dest: ~/.ssh/ansible
|
||||||
|
mode: 0600
|
||||||
|
- name: Create system copy of Ansible repo
|
||||||
|
git:
|
||||||
|
force: true
|
||||||
|
repo: https://gitlab.com/rehashedsalt/ansible
|
||||||
|
dest: /opt/ansible-repo
|
||||||
|
- name: Set up pull and run cronjob
|
||||||
|
cron:
|
||||||
|
hour: 0
|
||||||
|
name: ansible-pull
|
||||||
|
job: "cd /opt/ansible-repo && ansible-playbook ec2.yml"
|
||||||
become: true
|
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:
|
|
||||||
force: true
|
|
||||||
repo: https://gitlab.com/rehashedsalt/ansible
|
|
||||||
dest: ~/Projects/ansible
|
|
||||||
become: true
|
|
||||||
become_user: salt
|
|
||||||
|
Loading…
Reference in New Issue
Block a user