8000 syntax error still coming by rrgautam · Pull Request #12 · tonykay/bad-ansible · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

syntax error still coming #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
a36463a
added roles
Jul 23, 2018
4672b06
changed pgsql
Jul 23, 2018
25ee83c
changed tomcat tasks
Jul 23, 2018
178e2ba
syntax error fix
Jul 23, 2018
9fc2d5a
syntax error fix
Jul 23, 2018
491d11d
syntax error fix
Jul 23, 2018
8000
c9ff419
syntax error main.yml fix
Jul 23, 2018
61a5dc3
syntax error main.yml fix
Jul 23, 2018
ff0f994
syntax error main.yml fix
Jul 23, 2018
b5314b5
syntax error main.yml fix
Jul 23, 2018
a3e999e
syntax error main.yml fix
Jul 23, 2018
2133a91
syntax error main.yml fix
Jul 23, 2018
1cf338b
syntax error main.yml fix
Jul 23, 2018
49c02ac
commented pgsql
Jul 23, 2018
f3fc13e
pgsql role was missing
Jul 23, 2018
8ac4372
data dir for pgsql was not empty
Jul 23, 2018
64fab2c
added db again
Jul 23, 2018
8ff3f3f
pgsql fix
Jul 23, 2018
56408e5
added become
Jul 23, 2018
974c79a
pgsql issue fix
Jul 23, 2018
b0b073e
commented again
Jul 23, 2018
92f5d97
added whoami to check
Jul 23, 2018
bf8f88c
added info pgsql
Jul 23, 2018
f27b742
added pgsql check
Jul 23, 2018
3b12a9c
added for loop in haproxy
Jul 23, 2018
e3e8296
added another way to loop thru
Jul 23, 2018
0aa117c
removed useless comments
Jul 23, 2018
846eed2
added new role win
Jul 24, 2018
cc96044
added win role
Jul 24, 2018
352f1a4
added install
Jul 24, 2018
96ec7ae
added win_
Jul 24, 2018
67c595f
removed stuff
Jul 24, 2018
5f1639f
add vars
Jul 24, 2018
ea89524
path
Jul 24, 2018
a0878a4
added hardcoded
Jul 24, 2018
07df53b
added file mod
Jul 24, 2018
9141d5c
added vars
Jul 24, 2018
bc60d0c
added var
Jul 24, 2018
3049ff3
adding more
Jul 24, 2018
3cf9cec
wrong file name
Jul 24, 2018
f3a6747
domain name
Jul 24, 2018
5e2667c
added vars
Jul 24, 2018
3ef53f9
syntadx fix
Jul 24, 2018
1affb57
module wrong
Jul 24, 2018
2d4e9c6
module changed
Jul 24, 2018
8ddd17a
domain controller error
Jul 24, 2018
31ac29b
added firewall rules
Jul 24, 2018
18fe6d6
added win service config
Jul 24, 2018
ec7fe33
state changed to started
Jul 24, 2018
2b12b7a
create user
Jul 24, 2018
5397ae1
added 1 more
Jul 24, 2018
2a10b9f
added role
Jul 24, 2018
b252c7a
install win ad
Jul 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions 3tier-bad/ad.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# Bad ansible! This playbook is an example of poor/bad practices!
# Bad practices may include:
#
# Poor formatting and structure
# Poor use of YAML - but good enough to parse
# Inconsistent style
# Incorrect use of modules
# Poor module choice
# Unclear names
# Hard coding / poor use of variables
# Roles - what are roles?
# Bare variables
# No use of handlers

- hosts: windows
gather_facts: true
become: true
roles:
- win_ad_install


155 changes: 22 additions & 133 deletions 3tier-bad/bad-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,144 +13,33 @@
# Bare variables
# No use of handlers

- name: configuration
hosts: all
gather_facts: false # remove later! speeds up testing
- hosts: all
gather_facts: true
become: true
roles:
- base

tasks:
- name: enable repos
template:
src: ./open_three-tier-app.repo
dest: /etc/yum.repos.d/open_three-tier-app.repo
mode: 0644

- name: deploy haproxy
hosts: frontends
gather_facts: false # remove later! speeds up testing
become: true

tasks:
- name: http
package:
name: httpie
state: latest
- name: install HAProxy
yum:
name=haproxy state=latest
- name: enable HAProxy
service:
name: haproxy
state: started
- name: configure haproxy
template:
src: ./haproxy.cfg.j2
dest: /etc/haproxy/haproxy.cfg
- name: restart HAproxy
service:
name: haproxy
state: restarted


- name: deploy tomcat
hosts: apps
gather_facts: false
- hosts: frontends
gather_facts: true
become: true
roles:
- haproxy

tasks:
- name: install tomcat
package:
name: tomcat
state: latest
- name: enable tomcat at boot
service:
name: tomcat
enabled: yes

- name: create ansible tomcat directory
file:
path: /usr/share/tomcat/webapps/ROOT
state: directory

- name: copy static index.html to tomcat webapps/ansible/index.html
template:
src: index.html.j2
dest: /usr/share/tomcat/webapps/ROOT/index.html
mode: 0644

- name: start tomcat
service:
name: tomcat
state: started

- name: index.html on app 1
hosts: app1
gather_facts: false
- hosts: apps
gather_facts: true
become: true

tasks:
- name: copy static index.html to tomcat webapps/ansible/index.html
template:
src: index.html.app1
dest: /usr/share/tomcat/webapps/ansible/index.html

- name: index.html on app 1
hosts: app2
gather_facts: false
roles:
- tomcat

- hosts: appdbs
gather_facts: true
become: true

tasks:
- name: copy static index.html to tomcat webapps/ansible/index.html
template:
src: index.html.app2
dest: /usr/share/tomcat/webapps/ansible/index.html

- name: deploy postgres
hosts: apps
gather_facts: false
roles:
- pgsql

- hosts: apps
gather_facts: true
become: true
hosts: appdbs
tasks:
- name: install progress
command: "yum install -y postgresql-server"

#- name: install postgres
# yum:
# name: postgresql-server
# state: latest
- name: enable apache at boot
se 9E7A rvice:
name: postgresql
enabled: yes
- name: tell user to finish setting up postgres
debug:
msg: "Either uncomment the postgres setup or manually login and initialize"
roles:
- apache

# only run the next 2 tasks once!
# - name: initilize postgres
# command: postgresql-setup initdb
# - name: initilize postgres some more
# command: chkconfig postgresql on
- name: start postgres
service:
name: postgresql.service
state: started

- name: deploy apache
hosts: apps
gather_facts: false
become: true
hosts: apps
tasks:
- name: install apache
yum:
name: httpd
state: latest
- name: enable apache at boot
service:
name: httpd
enabled: yes
- name: start apache
service:
name: httpd
state: started
4 changes: 4 additions & 0 deletions 3tier-bad/my_ad_vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ad_domain_name: ad1.5f79.example.opentlc.com
ad_safe_mode_password: "jVMijRwLbI02gFCo2xkjlZ9lxEA7bm7zgg=="
ad_admin_user: "admin@{{ ad_domain_name}}"
ad_admin_password: "jVMijRwLbI02gFCo2xkjlZ9lxEA7bm7zgg=="
14 changes: 14 additions & 0 deletions 3tier-bad/roles/apache/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# base role for repo and packages
---
- name: install apache
yum:
name: httpd
state: latest
- name: enable apache at boot
service:
name: httpd
enabled: yes
- name: start apache
service:
name: httpd
state: started
8 changes: 8 additions & 0 deletions 3tier-bad/roles/base/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# base role for repo and packages
---
- name: enable repos
template:
# src: ./open_three-tier-app.repo
src: /home/rewati.raman.gautam-accenture.co/ansiblegit/bad-ansible/open_three-tier-app.repo
dest: /etc/yum.repos.d/open_three-tier-app.repo
mode: 0644
21 changes: 21 additions & 0 deletions 3tier-bad/roles/haproxy/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# base role for repo and packages
---
- name: http
package:
name: httpie
state: latest
- name: install HAProxy
yum:
name=haproxy state=latest
- name: enable HAProxy
service:
name: haproxy
state: started
- name: configure haproxy
template:
src: ./haproxy.cfg.j2
dest: /etc/haproxy/haproxy.cfg
- name: restart HAproxy
service:
name: haproxy
state: restarted
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,13 @@ backend app-servers
mode http
balance roundrobin
option forwardfor
server app1 app1.{{GUID}}.internal:8080 cookie app1 check
server app2 app2.{{GUID}}.internal:8080 cookie app2 check
# {% for server in groups.apps %}
# server {{server.split('.')[0] }} {{server}}:8080 cookie {{server.split('.')[0] }} check
# {%endfor %}

{% for server in groups.apps %}
server app{{ loop.index }} {{ inventory_hostname }}:8080 cookie app{{ loop.index }} check
{%endfor %}

# server app1 app1.{{GUID}}.internal:8080 cookie app1 check
# server app2 app2.{{GUID}}.internal:8080 cookie app2 check
51 changes: 51 additions & 0 deletions 3tier-bad/roles/pgsql/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# base role for repo and packages
---
- name: install progress
command: "yum install -y postgresql-server"

- name: whoami
shell: whoami

- name: whoami
shell: ls -lart /var/lib/pgsql/

# - name: install postgres
# yum:
# name: postgresql-server
# state: latest
- name: enable apache at boot
service:
name: postgresql
enabled: yes
- name: tell user to finish setting up postgres
debug:
msg: "Either uncomment the postgres setup or manually login and initialize"

# - name: stat ansible configuration file
# stat:
# path: "/var/lib/pgsql/data"
# register: stat_ansible_config

- name: Check if PostgreSQL database is initialized.
stat:
path: "/var/lib/pgsql/data"
register: pgdata_dir_version

# only run the next 2 tasks once!
# - name: initilize postgres
# command: postgresql-setup initdb
# - name: initilize postgres some more
# command: chkconfig postgresql on

- name: Ensure PostgreSQL database is initialized.
command: postgresql-setup initdb
when: not pgdata_dir_version.stat.exists

- name: Ensure PostgreSQL database is Checkconfig on.
command: chkconfig postgresql on
when: not pgdata_dir_version.stat.exists

- name: start postgres
service:
name: postgresql.service
state: started
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions 3tier-bad/roles/tomcat/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# base role for repo and packages
---
- name: install tomcat
package:
name: tomcat
state: latest
- name: enable tomcat at boot
service:
name: tomcat
enabled: yes

- name: create tomcat directory
file:
path: /usr/share/tomcat/webapps/ROOT/
state: directory
mode: 0755

- name: create ansible tomcat directory
file:
path: /usr/share/tomcat/webapps/ansible
state: directory
mode: 0755

- name: copy static index.html to tomcat webapps/ansible/index.html
template:
src: index.html.j2
dest: /usr/share/tomcat/webapps/ROOT/index.html
mode: 0755

- name: start tomcat
service:
name: tomcat
state: started


- name: copy static index.html to tomcat webapps/ansible/index.html
template:
src: index.html.j2
dest: /usr/share/tomcat/webapps/ansible/index.html

File renamed without changes.
36 changes: 36 additions & 0 deletions 3tier-bad/roles/win_ad_install/tasks/main.yml
2851
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---

- name: Include vars
include_vars:
file: ad.yml


- name: Install AD-Domain-Services
win_feature:
name: AD-Domain-Services
state: present

# - name: Domain Controller
# include_vars: ad.yml
# win_domain_controller:
# dns_domain_name: ad1.766a.example.opentlc.com
# domain_admin_user: admin@ad1.766a.example.opentlc.com
# domain_admin_password: jVMijRwLbI02gFCo2xkjlZ9lxEA7bm7zgg==
# safe_mode_password: jVMijRwLbI02gFCo2xkjlZ9lxEA7bm7zgg==
# state: domain_controller
# log_path: c:\ansible_win_domain_controller.txt

- name: Domain Controller
# include_vars: ad.yml
win_domain:
dns_domain_name: "{{ad_domain_name}}"
domain_admin_user: "{{ad_admin_user }}"
domain_admin_password: "{{ad_safe_mode_password}}"
safe_mode_password: "{{ad_safe_mode_password}}"

- name: Reboot win machine
win_reboot:
reboot_timeout: 3600

- name: Reboot win machine
shell: nltest /dclist:"{{ ad_domain_name }}"
4 changes: 4 additions & 0 deletions 3tier-bad/roles/win_ad_install/vars/ad.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ad_domain_name: ad1.5f79.example.opentlc.com
ad_safe_mode_password: "jVMijRwLbI02gFCo2xkjlZ9lxEA7bm7zgg=="
ad_admin_user: "admin@{{ ad_domain_name}}"
ad_admin_password: "jVMijRwLbI02gFCo2xkjlZ9lxEA7bm7zgg=="
Loading
0