Lots: Add a new Ansible role, prepare for an EC2 inventory migration
This commit is contained in:
parent
3823f7a47f
commit
b8238a062d
@ -4,3 +4,4 @@ remote_user = ubuntu
|
|||||||
private_key_file = ~/.ssh/ansible
|
private_key_file = ~/.ssh/ansible
|
||||||
ssh_extra_args =-o ForwardAgent=yes -o StrictHostKeyChecking=no
|
ssh_extra_args =-o ForwardAgent=yes -o StrictHostKeyChecking=no
|
||||||
deprecation_warnings = false
|
deprecation_warnings = false
|
||||||
|
ask_vault_pass = true
|
||||||
|
6
hosts
6
hosts
@ -1,8 +1,10 @@
|
|||||||
all:
|
all:
|
||||||
hosts:
|
hosts:
|
||||||
children:
|
children:
|
||||||
|
ansible:
|
||||||
|
hosts:
|
||||||
|
playground.dragonfucker.club:
|
||||||
aws:
|
aws:
|
||||||
hosts:
|
hosts:
|
||||||
ec2-3-15-44-30.us-east-2.compute.amazonaws.com:
|
3.15.238.110:
|
||||||
ec2-18-224-139-59.us-east-2.compute.amazonaws.com:
|
|
||||||
# vim:ft=ansible:
|
# vim:ft=ansible:
|
||||||
|
@ -3,5 +3,7 @@
|
|||||||
---
|
---
|
||||||
- hosts: aws
|
- hosts: aws
|
||||||
roles:
|
roles:
|
||||||
- user
|
|
||||||
- common
|
- common
|
||||||
|
- hosts: ansible
|
||||||
|
roles:
|
||||||
|
- ansiblehost
|
||||||
|
11
roles/ansiblehost/files/awscredentials
Normal file
11
roles/ansiblehost/files/awscredentials
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
|
38616333383866663466353035306234356565643564383866633038636531616239393365636436
|
||||||
|
6538393064666337616565616636363331333062643235340a613061356630656333626664343038
|
||||||
|
39326661306439343666623339323430333662363864366364363664323833393039303938323035
|
||||||
|
3061396662656435660a366361363138386332633234633832613630643364316130643665343737
|
||||||
|
37303434633839323363376562303966363466323638616265303865343936396465616434666163
|
||||||
|
61666663373333643034363663323465326130393331636463666534343837646466653265343162
|
||||||
|
39343066323764646361323833303334643730633938633436343330626230303462666166356530
|
||||||
|
63623861383436636137623733633839333564363334323034313537616633666436333133396639
|
||||||
|
63666237366535386436343839653939373533656164333865613631386131343565363734333935
|
||||||
|
3861623666613138353061646564393465356532316631616231
|
40
roles/ansiblehost/tasks/main.yml
Normal file
40
roles/ansiblehost/tasks/main.yml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/ansible-playbook
|
||||||
|
# vim:ft=ansible:
|
||||||
|
---
|
||||||
|
- name: Basic setup
|
||||||
|
include_role:
|
||||||
|
name: common
|
||||||
|
- name: Install Ansible-required packages
|
||||||
|
apt:
|
||||||
|
name: "{{ packages }}"
|
||||||
|
vars:
|
||||||
|
packages:
|
||||||
|
- ansible
|
||||||
|
- python-boto3
|
||||||
|
- python-botocore
|
||||||
|
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: Create Projects directory for salt
|
||||||
|
file:
|
||||||
|
path: ~/Projects
|
||||||
|
state: directory
|
||||||
|
become: true
|
||||||
|
become_user: salt
|
||||||
|
- name: Clone Ansible repository
|
||||||
|
git:
|
||||||
|
repo: git@gitlab.com:rehashedsalt/ansible
|
||||||
|
dest: ~/Projects/ansible
|
||||||
|
become: true
|
||||||
|
become_user: salt
|
@ -15,3 +15,6 @@
|
|||||||
packages:
|
packages:
|
||||||
- vim
|
- vim
|
||||||
become: true
|
become: true
|
||||||
|
- name: Set up users
|
||||||
|
include_role:
|
||||||
|
name: user
|
||||||
|
Loading…
Reference in New Issue
Block a user