Add jenkinsfile for ansible execution
This commit is contained in:
9
ansible/ansible.cfg
Normal file
9
ansible/ansible.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
[defaults]
|
||||
host_key_checking = False
|
||||
inventory = inventory_aws_ec2.yaml
|
||||
|
||||
interpreter_python = /usr/bin/python3
|
||||
enable_plugins = aws_ec2
|
||||
|
||||
remote_user = ec2-user
|
||||
private_key_file = ~/ssh-key.pem
|
||||
9
ansible/inventory_aws_ec2.yaml
Normal file
9
ansible/inventory_aws_ec2.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
plugin: aws_ec2
|
||||
regions:
|
||||
- eu-west-3
|
||||
keyed_groups:
|
||||
- key: tags
|
||||
prefix: tag
|
||||
- key: instance_type
|
||||
prefix: instance_type
|
||||
29
ansible/my-playbook.yaml
Normal file
29
ansible/my-playbook.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
- name: Install python3, docker, docker-compose
|
||||
hosts: all
|
||||
become: yes
|
||||
gather_facts: False
|
||||
tasks:
|
||||
- name: Install python3 and docker
|
||||
vars:
|
||||
ansible_python_interpreter: /usr/bin/python
|
||||
yum:
|
||||
name:
|
||||
- python3
|
||||
- docker
|
||||
update_cache: yes
|
||||
state: present
|
||||
- name: Install Docker-compose
|
||||
get_url:
|
||||
url: https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-{{lookup('pipe', 'uname -m')}}
|
||||
dest: /usr/local/bin/docker-compose
|
||||
mode: +x
|
||||
- name: Start docker daemon
|
||||
systemd:
|
||||
name: docker
|
||||
state: started
|
||||
- name: Install docker python module
|
||||
pip:
|
||||
name:
|
||||
- docker
|
||||
- docker-compose
|
||||
Reference in New Issue
Block a user