Skip to content

Commit

Permalink
[Refactor] ansible galaxy directory
Browse files Browse the repository at this point in the history
  • Loading branch information
wdrdres3qew5ts21 committed Jun 9, 2020
1 parent 3d5fdbf commit edc0904
Show file tree
Hide file tree
Showing 45 changed files with 916 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Ansible-ELK-Stack/roles/elk/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
# vars file for elk
# vars file for elk
kibana_password: PleaseChangeMe
12 changes: 10 additions & 2 deletions Ansible-ELK-Stack/roles/elk_ssl/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
---
# vars file for elk
$ANSIBLE_VAULT;1.1;AES256
63356536353161643466306237376139666236303963636638353130626138386661653635616639
3565363231303364353738613430386231353161306537620a313364306463643837313866383933
39336638633934373263386666633061626230613935666435633765343734353435393664356563
6563393538623632340a623830306137326666356363343638633236343538373331643530626236
65323739386564666363626238666231653130376661333164646366303034316630663038376230
63646338653131353565626161333762646237656433376338633064396364643034393131646539
31653731353738636530393164373662613433393738316633313366633065643332366437656232
36666662356232633362643932326339663834326466626666323864353463313136346533373061
3665
1 change: 0 additions & 1 deletion Ansible-ELK-Stack/setupKibanaPassword.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ do
sleep 5
done

echo "fuckkkkkkkkkkkkkkkkkkk"
curl -X POST -v -k "https://localhost:9200/_security/user/kibana/_password?pretty" -u elastic:PleaseChangeMe -H 'Content-Type: application/json' -d ' { "password" : "PleaseChangeMe" } '
3 changes: 3 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[defaults]
host_key_checking=False
inventory=./inventory
85 changes: 85 additions & 0 deletions install-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
--- #centos8 edition
- hosts: elk_server
become: yes
become_method: sudo
tasks:
- name: VIEW ALL ANSIBLE FACT KEYS
debug:
msg: "{{ ansible_facts }}"

- name: "Remove All Deprecated/ Install Docker"
yum:
name: "{{ item }}"
state: absent
loop:
- docker
- docker-client
- docker-client-latest
- docker-common
- docker-latest
- docker-latest-logrotate
- docker-logrotate
- docker-engine

- name: "Install yum-utils"
yum:
name: yum-utils
state: present

- name: "Add Repository repo yum-config-manager"
command: yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

- name: "DNF package update containerd.io"
yum:
name: "https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm"
state: present

- name: "Yum install Docker"
yum:
name: "{{ item }}"
state: present
loop:
- docker-ce
- docker-ce-cli
- containerd.io

- name: "Start Docker Service"
service:
name: docker
state: reloaded

- name: "Add ansible_user (login user) to docker group"
user:
name: "{{ ansible_user }}"
shell: /bin/bash
groups: docker
append: yes

- name: "Install Git & Python"
yum:
name: "{{ item }}"
state: present
loop:
- git
- python3

- name: "Install docker-compose"
yum:
name: "{{ item }}"
state: present
loop:
- git
- python3













4 changes: 4 additions & 0 deletions install-elk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--- #centos8 edition
- hosts: elk_server
roles:
- elk
29 changes: 29 additions & 0 deletions roles/docker/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
language: python
python: "2.7"

# Use the new container infrastructure
sudo: false

# Install ansible
addons:
apt:
packages:
- python-pip

install:
# Install ansible
- pip install ansible

# Check ansible version
- ansible --version

# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg

script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
38 changes: 38 additions & 0 deletions roles/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Role Name
=========

A brief description of the role goes here.

Requirements
------------

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.

Role Variables
--------------

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Dependencies
------------

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook
----------------

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
roles:
- { role: username.rolename, x: 42 }

License
-------

BSD

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
2 changes: 2 additions & 0 deletions roles/docker/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# defaults file for docker
2 changes: 2 additions & 0 deletions roles/docker/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for docker
53 changes: 53 additions & 0 deletions roles/docker/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)

min_ansible_version: 2.9

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99

galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.

dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

85 changes: 85 additions & 0 deletions roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
# tasks file for docker
- name: VIEW ALL ANSIBLE FACT KEYS
debug:
msg: "{{ ansible_facts }}"

- name: "Remove All Deprecated/ Install Docker"
yum:
name: "{{ item }}"
state: absent
loop:
- docker
- docker-client
- docker-client-latest
- docker-common
- docker-latest
- docker-latest-logrotate
- docker-logrotate
- docker-engine

- name: "Install yum-utils"
yum:
name: yum-utils
state: present

- name: "Add Repository repo yum-config-manager"
command: yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

- name: "DNF package update containerd.io"
yum:
name: "https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm"
state: present

- name: "Yum install Docker"
yum:
name: "{{ item }}"
state: present
loop:
- docker-ce
- docker-ce-cli
- containerd.io

- name: "Start Docker Service"
systemd:
name: docker
state: reloaded
enabled: yes

- name: "Add ansible_user (login user) to docker group"
user:
name: "{{ ansible_user }}"
shell: /bin/bash
groups:
- docker
append: yes

- name: "Install Git & Python"
yum:
name: "{{ item }}"
state: present
loop:
- git
- python3
- python3-pip

- name: "pip install docker-compose"
pip:
name: docker-compose
state: present

# - name: "CURL docker-compose"
# get_url:
# url: "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-{{ansible_system}}-{{ansible_userspace_architecture}}"
# dest: "/usr/local/bin/docker-compose"

# - name: "Add permission to docker-compose inorder to run execute bin command"
# file:
# path: /usr/local/bin/docker-compose
# mode: +x

# - name: "Add Symbolik Link to docker-compose bin /usr/bin"
# file:
# state: link
# src: /usr/local/bin/docker-compose
# dest: /usr/bin/docker-compose
2 changes: 2 additions & 0 deletions roles/docker/tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
localhost

5 changes: 5 additions & 0 deletions roles/docker/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- docker
2 changes: 2 additions & 0 deletions roles/docker/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# vars file for docker
29 changes: 29 additions & 0 deletions roles/elk/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
language: python
python: "2.7"

# Use the new container infrastructure
sudo: false

# Install ansible
addons:
apt:
packages:
- python-pip

install:
# Install ansible
- pip install ansible

# Check ansible version
- ansible --version

# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg

script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
Loading

0 comments on commit edc0904

Please sign in to comment.