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